TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: viva on September 28, 2006, 08:47:05 AM
-
hi everybody,
i had copied the polyline features by using
(setq sel(ssget "x" (list(cons 0 "lwpolyline")(cons 8 "layer1"))))
(if sel
(progn
(setq cnt 0)
(repeat (- (length sel) 1)
(setq ent(ssname sel cnt))
(setq obj(vlax-ename->vla-object ent)
(setq cop(vla-copy obj)
then i want 2 create a new layer and put the copied features in that layer thru vla functions.
i had used
vla-add
but it is showing " activex error"
can anyone help regarding this things
thanks in advance
regards
vivek
<edit: corrected code tags>
-
Look into this:
(vla-put-layer newpline (vla-get-layer obj))
-
hi cab,
thanks for ur immediate reply. (vla-get-layer obj) .can u tell me here obj means. obj means layername or objectname. plz explain me. that will help me alot. i cant able 2 find out vla functions in help.
i got error while using
(vla-put-layer newpline (vla-get-layer obj))
; error: bad argument type: VLA-OBJECT nil
thanks
regards
vivek
-
it is the object layer
property name <correction>
(setq obj (vlax-ename->vla-object (car(entsel))))
-
You use (vla-add ... ) when you want to create something new somewhere. In your case, you would use it if the layer doesn't exist in the drawing. To get the active drawing (document) use
(setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
Then if you want to add a layer, you have to get the layer collection (table) first, like so
(setq LayCol (vla-get-Layers ActDoc))
Now if you want to add the new layer, now you use add like so
(vla-Add LayCol "MyNewLayerName")
Now if you want to put the objects returned by (vla-copy ... ), I would use 'copy' like you have it, and then you just need to update the layer of the new object you created, so add this portion to your code after you copy.
(vla-put-Layer cop "MyNewLayerName")
Hope that makes sense.
-
Thanks Tim for the clarification & correction.
I guess I shot through here too fast this morning. :-)
-
Thanks Tim for the clarification & correction.
I guess I shot through here too fast this morning. :-)
No problem Alan. I help where I can. :-)
-
Thanks to both of you for clarifying and explaining how things work.
I will go back to watch and learning now.
:-)
-
hi
thanks for both. i had learned new things from ur discussion. it helped alot
regards
vivek
-
The ``vla'' prefix is used for accessing methods and properties of ActiveX objects.
The ``vlax'' prefix is a general prefix used for other ActiveX objects. (like word, excel, …Other applications in general.) You use this prefix to get/put properties of other ActiveX objects.