Print Page | Close Window

Create New Layer w/ modifiers

Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DWF formats, Design Review, AutoCAD 360, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=5223
Printed Date: 18.May.2026 at 09:12


Topic: Create New Layer w/ modifiers
Posted By: kameron1967
Subject: Create New Layer w/ modifiers
Date Posted: 30.Jan.2011 at 18:13
Hi guys,
 
I wonder if you could help me.  I wanted to create options to modify an existing layer by creating new layers from whichever item I choose by adding one of these modifiers -N-PKG1 or -D-PKG1 or -V-PKG1 when creating a new layer.  So if an entity selected is on a layer called A-ANNO, I would like the option to choose letters N or D or V to decide which modifier to create from existing layer A-ANNO.  So if I choose N, it will create a new layer called A-ANNO-N-PKG1.
 
I'm not sure what the best approach is.  The easiest option would be to first choose either A or D or V before selecting an entity's layer and make a new layer.  A more sophisticated option would be to choose first, then decide on the modifier.  If anyone would like to guide me through the process, I sure would really appreciate it.  Thanks, again! Smile



Replies:
Posted By: CarlB
Date Posted: 31.Jan.2011 at 03:11
It's no more difficult to allow user to decide after picking.
 
(setq PickItem (car (entsel "\nPick object for new layer: ")))
(setq ObjLayer (cdr (assoc 8 (entget pickItem))))
(setq ObjType (cdr (assoc 0 (entget pickItem))))
(princ (strcat ObjLayer is layer name of " ObjType " selected"))
(initget "N D V")
(Setq LyrSuffix (getkword "\nEnter suffix type [N-PKG-1/D-PKG1/V-PKG-1]:"))
..you can take it from here...:)
 



Print Page | Close Window