ccowgill Posted December 2, 2010 Author Posted December 2, 2010 so to freeze the layers that are now created, I just added the following code within the vlax-for l function (vl-catch-all-apply 'vla-put-Freeze (list l :vlax-true)) Quote
Lee Mac Posted December 2, 2010 Posted December 2, 2010 That may work - I've never tested to see if a layer status is retained following the CopyObjects operation. Quote
ccowgill Posted December 2, 2010 Author Posted December 2, 2010 it appears to, as I have tested it and it does freeze the newly created layers. On the [cr] and snvalid, I checked and it is not allowing a space at the beginning of a string, so I'll just resolve it by adding the space to the strcat: Command: (snvalid " test") nil Command: (snvalid "to test") T Quote
Lee Mac Posted December 2, 2010 Posted December 2, 2010 Yes, I meant with the snvalid removed as well - see the code in the original post. Quote
ccowgill Posted December 2, 2010 Author Posted December 2, 2010 Ok, I got it. thanks again for all your help. Quote
alanjt Posted December 2, 2010 Posted December 2, 2010 What about something like this? (defun c:CopyToLayerWithSuffix (/ suffix ss) ;; Alan J. Thompson, 12.02.10 (vl-load-com) (setq suffix (getstring T "\nSpecify layer suffix: ")) (if (setq ss (ssget "_:L")) ((lambda (layers match / name layer new item) (vlax-for x (setq ss (vla-get-activeselectionset *AcadDoc*)) (or (wcmatch (strcase (setq layer (vla-get-layer x))) match) (vla-put-layer (vla-copy x) (cond ((cdr (assoc 2 (tblsearch "LAYER" (setq name (strcat layer suffix)))))) ((setq new (vla-add layers name) item (vla-item layers layer) ) (foreach p '(Color Description Linetype Lineweight Material PlotStyleName TrueColor) (vl-catch-all-apply (function vlax-put-property) (list new p (vlax-get-property item p)) ) ) name ) ) ) ) ) (vla-delete ss) ) (vla-get-layers (cond (*AcadDoc*) ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object)))) ) ) (strcat "*" suffix) ) ) (princ) ) Quote
Lee Mac Posted December 2, 2010 Posted December 2, 2010 Nice one Alan - that was the way I was initially suggesting - I just didn't want the legwork of copying all the layer properties Quote
alanjt Posted December 2, 2010 Posted December 2, 2010 Nice one Alan - that was the way I was initially suggesting - I just didn't want the legwork of copying all the layer properties Thanks. I was thinking the same thing about ODBX. Quote
ccowgill Posted December 2, 2010 Author Posted December 2, 2010 well that would put it back in line, coding style-wise, with the layer/layerstate program you helped me out with a few months ago at AUGI. Although looking at Lee's coding, it looks very similar to what was done in the original LAFreeze program I was trying to modify. Perhaps Lee wrote it originally? Quote
Lee Mac Posted December 2, 2010 Posted December 2, 2010 well that would put it back in line, coding style-wise, with the layer/layerstate program you helped me out with a few months ago at AUGI. Although looking at Lee's coding, it looks very similar to what was done in the original LAFreeze program I was trying to modify. Perhaps Lee wrote it originally? I'm afraid I've written too much code to remember I'd have to see the code... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.