PDA

View Full Version : How to deplace an object from layer "0" to another layer ?


nfyu
2008-12-16, 09:38 PM
Hi,

If there is someone knows how to deplace an object from layer "0" to another layer by lisp routine ?

Thanks for any advice

Opie
2008-12-16, 09:42 PM
How much AutoLISP do you know?

nfyu
2008-12-16, 09:52 PM
I know AutoLISP much more than one new-bee, but less than an experter, sorry.

ccowgill
2008-12-16, 09:55 PM
Fish or Fishin' pole?
I would suggest using Vla-put-layer to put the object on a specified layer

select the object
convert the object to vlax-object
put the layer to the object
release the object

nfyu
2008-12-16, 10:06 PM
Thanks very much

lpseifert
2008-12-17, 01:41 AM
Fish or Fishin' pole?
I would suggest using Vla-put-layer to put the object on a specified layer

select the object
convert the object to vlax-object
put the layer to the object
release the object


Just out of curiosity, why is it preferred to release the object?

ccowgill
2008-12-17, 02:06 PM
Just out of curiosity, why is it preferred to release the object?I dont know, I saw someone else do it, I personally do not ever really recall doing it myself. It may not be necessary, but maybe someone else that knows the importance/non importance of releasing a vla object.

Help has the following to say:

Releases a drawing object
(vlax-release-object obj)
When an AutoLISP routine no longer uses an object outside AutoCAD, such as a Microsoft Excel object, call the (vlax-release-object) function to make sure that the associated application closes properly. Objects released with (vlax-release-object...) may not be released immediately. The actual release may not happen until the next automatic garbage collection occurs. You can call (gc) directly to force the garbage collection to occur at a specific location within your code. However, calling (gc) may degrade performance, and it is recommended that you avoid placing calls to (gc) in locations where it is likely to be called many times in a row, such as within loops.
If an object-associated application does not close after calling the (gc) function, the (vlax-release-object) function was not called for all objects outside AutoCAD.
Arguments
obj A VLA-object.

After release, the drawing object is no longer accessible through obj.
Return Values
Unspecified.

kennet.sjoberg
2008-12-17, 09:31 PM
Just out of curiosity, why is it preferred to release the object?
I will say that (vlax-release-object) try to close an associated application, such as a Microsoft Excel object, sometimes the Excel process is still visible in the task manager.

It is not necessary to use (vlax-release-object) when manipulating an object in current AutoCAD task, but if you release it, the drawing object is no longer accessible.


: ) Happy Computing !

kennet