- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I made this simple routine to create a layer :
(defun c:createLayerTex (/ acadObj doc layers newLayer)
(setq acadObj (vlax-get-acad-object)
doc (vla-get-ActiveDocument acadObj)
layers (vla-get-Layers doc)
newLayer (vla-Add layers "Tx-0-Textes")
);setq
;I set the following vla-put, because If the layer already exists, and If it does not have this properties, I would like to replace those informations.
(vla-put-color newLayer 5)
(vla-put-linetype newLayer "Hidden")
(vla-put-layeron newLayer :vlax-true)
(vla-put-freeze newLayer :vlax-false)
(vla-put-Lock newLayer :vlax-false)
);defun
My problem is:
If I already have this layer in my drawing, and it is not current, nothing happens. That is OK.
But, If I already have this layer in my drawing, and it is current, the following message appears :
Command: CREATELAYERTEX
; error: Automation Error. Invalid layer
Any help?
Thanks.
Solved! Go to Solution.