PDA

View Full Version : problem with "entlast"


bmckenzie
2008-06-27, 08:50 PM
I have a routine written to offset an object and change the new object to the current layer. I plan to eventually loop the code to allow me to offset more than one object, but one at a time will do for now. The problem is "entlast" is retrieving the name of the last object added prior to the current routine. How can I get "entlast" to assign the name of the object added by my command line?

(defun c:otc (/ clayr ent)
(command ".offset") ;;;This is where I offset a polyline, which creates the object whos
;;;;layer I want to change
(setq clayr (getvar "clayer"))
(setq ent (entget (entlast))) ;;;I want this to use the obejct just created, but it does not.
(setq ent (subst (cons 8 clayr)(assoc 8 ent) ent))
(entmod ent)
(princ))

Moderator Note:
Please use [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code)

CAB2k
2008-06-27, 08:56 PM
Have a look at this.

bmckenzie
2008-06-27, 11:46 PM
Hey, thanks! That is exactly what I wanted to end up with.

CAB2k
2008-06-27, 11:57 PM
you're welcome :)

ccowgill
2008-06-30, 02:04 PM
I have a routine written to offset an object and change the new object to the current layer. I plan to eventually loop the code to allow me to offset more than one object, but one at a time will do for now. The problem is "entlast" is retrieving the name of the last object added prior to the current routine. How can I get "entlast" to assign the name of the object added by my command line?

(defun c:otc (/ clayr ent)
(command ".offset") ;;;This is where I offset a polyline, which creates the object whos
;;;;layer I want to change
(setq clayr (getvar "clayer"))
(setq ent (entget (entlast))) ;;;I want this to use the obejct just created, but it does not.
(setq ent (subst (cons 8 clayr)(assoc 8 ent) ent))
(entmod ent)
(princ))Moderator Note:<b> Please use [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code)</b>
if you use Express Tools, there is a command called exoffset, it allows you to specify several different options when offseting lines, placing the new object on the current layer is one of them.

Tom Beauford
2008-06-30, 05:54 PM
if you use Express Tools, there is a command called exoffset, it allows you to specify several different options when offseting lines, placing the new object on the current layer is one of them.
Don't know when they changed it, but you can do all that in 2008 & 2009 with the standard Offset command.

ccowgill
2008-06-30, 09:50 PM
Don't know when they changed it, but you can do all that in 2008 & 2009 with the standard Offset command.
you are quite right, but you cant do multiple offsets without an additional prompt, IMO it is easier to just hold shift and keep clicking then remember to hit m for multiple.

irneb
2008-07-02, 08:11 AM
IMO it is easier to just hold shift and keep clicking then remember to hit m for multiple.Huhhh! One keypress & hold is easier than one keypress and release?

ccowgill
2008-07-02, 01:44 PM
Huhhh! One keypress & hold is easier than one keypress and release?
well, what the heck is my left hand supposed to do while my right hand is having all the fun clicking for additional offsets?:lol:, and dont you have to hit enter after you hit m for multiple?

irneb
2008-07-02, 04:34 PM
and dont you have to hit enter after you hit m for multiple?Ohhh yes! I just don't even think about the space bar as a key press. Sometimes it's so bad I'm typing words with spaces inbetween each charecter:Oops:.
well, what the heck is my left hand supposed to do while my right hand is having all the fun clicking for additional offsets?There are things I can think of:roll:, but this is a public forum.

bmckenzie
2008-07-09, 08:23 PM
I never look at the prompt, but the standard offset command allows you to change layers. Duhhh...
Thanks all!