HiOriginally Posted by johnh.101098
Take a look at the AutoCAD command _.LayTrans
Have a good one, Mike
|
|
|
HiOriginally Posted by johnh.101098
Take a look at the AutoCAD command _.LayTrans
Have a good one, Mike
If you always do the same translation (i.e., someone regularly sends you drawings, and they always use the same layer names, and you always want them changed to your layer names, which also are always the same), then you can just save the mapping as a DWS file. Then just load the DWS file into Layer Translator and hit "Translate" - nice and painless.Originally Posted by johnh.101098
is there a way to easily modify this lisp routine to find replace *_* to *-*
I am a beginner in Lisp. So please tolerate.....
Can you please alter this code so as to rename the layers like
GroundFloorPlan$0$A-ANNO-DIMS to A-ANNO-DIMS?
But in that case it has to check;
If
the layer A-ANNO-DIMS already exists, and if so it has to merge GroundFloorPlan$0$A-ANNO-DIMS to A-ANNO-DIMS.
Else
Rename it to A-ANNO-DIMS
Could you please help me out in this?
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000
One more way, but only works for single character replacement...
The main purpose for showing this is that it's a lot faster than searching through a list with vl-string-search.Code:((lambda (str) (if (eq (type str) 'STR) (vl-list->string (mapcar (function (lambda (s) (if (eq 95 s) 45 s ) ) ) (vl-string->list str) ) ) ) ) "Pizza_And_Beer" )
Here's mine, which does what you're referring to:Edit: As for the other question about "_" to "-", change the check for "$" to "_" - but also it would need a slightly different portion for calculating the new name. Instead of:Code:(vl-load-com) (defun c:LayerClean (/ layers lo name badlayers name1 pos) (setvar "CLAYER" "0") (setq layers (vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object)))) (vlax-for lo layers (setq name (vla-get-Name lo)) (cond ((and (vl-string-search "$" name) (not (vl-string-search "|" name))) (setq badlayers (cons name badlayers)) ) ) ) (foreach name badlayers (setq name1 name lo (vla-Item layers name) ) (while (setq pos (vl-string-search "$" name1)) (setq name1 (substr name1 (+ pos 2))) ) (cond ((tblsearch "LAYER" name1) (command "-LAYMRG" "_Name" name "" "_Name" name1 "_Yes") ) (t (vla-put-Name lo name1) ) ) ) (princ) )You should have:Code:(while (setq pos (vl-string-search "$" name1)) (setq name1 (substr name1 (+ pos 2))) )Code:(setq name1 (vl-list->string (subst (ascii "-") (ascii "_") (vl-string->list name))))
Last edited by irneb; 2010-08-25 at 12:55 PM.
I love this place!
I just ran into this exact problem!
I'm adding this routine to my toolbars & Tool Palettes.
Thanks,
Greg D.
This lisp rocks! Could you give me a hint how to modify it to pass through Autocad Architecture STYLES and rename those too?
Thanks in advance.
Steve in Alaska
You're all welcome.
It's a bit more involved when it comes to styles. Unfortunately there no such command as DimStyleMerge, TextStyleMerge or LinetypeStyleMerge. The renaming portion might work normally, but with this scenario there's a high probability of 2 (or more) styles becoming one in the end - which would make rename only possible for the 1st style. As for ACA styles, I've not done much work in ACA as yet (more into Revit for that type of drawing work) - so I can't say with certainty it's going to be easy. The ACA (e.g. Wall) styles may just be saved as dictionaries (like the MLeader styles are) instead of tables (as the Layers, Linetypes, Text & Dimstyles are).
Which means the lisp will have to step through the entire DWG (including all the blocks) and modify each entity to the required style, then purge the wrong style from the DWG. BTW, that's what the LayMrg command does with layers.