Creating LiSP to isolate drawing layers w/ & w/out Xrefs
Creating LiSP to isolate drawing layers w/ & w/out Xrefs
(OP)
I've done some searching and tried to modify several versions of LiSP I've found, but non of them do exactly what I need... well, entirely what I need, just a variation of.
I'm not very familiar with LiSP, hence the troubles, and I've spent too many hours trying to figure this out all alone. Will someone please advise me of my best options and the process of figuring this out?
Okay, here we go:
I'm trying to turn on/off several layers that are drawing based plus others that are named the same but are Xref based.
I've attached a drawing containing all of my layers w/ a bound Xref representing another drawing containing more of the same layers.
The reason behind this:
I have broken my trade into 4 parts. Each part will Xref each of the other three parts. Although the layers from the other drawings use only some of my standard layers, I still want to maintain full control of those layers while they are being Xref'd using LiSP.
I created this LiSP using three other LiSP Routines I found across different sites, it works but it's really slow and choppy.
(defun c:alf ()
(setq LayList '(
"0"
"*|B-150U50-54";
"*|B-150Z150-54"
"*|B-###S*'"
"*|B-###T*"
"*|B-B*"
"*|B-CLheadwall"
"*|B-Cloud"
"*|B-DiagonalKicker"
"*|B-DimCoord"
"*|B-DimCoordBKG"
"*|B-Logo"
"*|B-SoffitSolid"
"*|B-StudDirection"
"*|B-StudSOLO"
"*|B-Symbol-*"
"*|BD-*"
"*|BDW-*"
"*|BH-*"
"*|BW-*"
"B-150U50-54";
"B-150Z150-54"
"B-###S*"
"B-###T*"
"B-B*"
"B-CLheadwall"
"B-Cloud"
"B-DiagonalKicker"
"B-DimCoord"
"B-DimCoordBKG"
"B-Logo"
"B-SoffitSolid"
"B-StudDirection"
"B-StudSOLO"
"B-Symbol-*"
"BD-*"
"BDW-*"
"BH-*"
"BW-*"));
(foreach x LayList
(setq LayName (strcat x))
(command "layer" "off" LayName "" "")
);
(princ)
;clean running
) ;end defun
What I mean is, each layer is being turned off but it's running a command for each layer, first Xref based and then drawing based, which takes forever due to the amount of layers.
If you require anything more just ask and I'll be more than happy to help you -Help me!
Thanks in advance for all of your hard work and help.
I'm not very familiar with LiSP, hence the troubles, and I've spent too many hours trying to figure this out all alone. Will someone please advise me of my best options and the process of figuring this out?
Okay, here we go:
I'm trying to turn on/off several layers that are drawing based plus others that are named the same but are Xref based.
I've attached a drawing containing all of my layers w/ a bound Xref representing another drawing containing more of the same layers.
The reason behind this:
I have broken my trade into 4 parts. Each part will Xref each of the other three parts. Although the layers from the other drawings use only some of my standard layers, I still want to maintain full control of those layers while they are being Xref'd using LiSP.
I created this LiSP using three other LiSP Routines I found across different sites, it works but it's really slow and choppy.
(defun c:alf ()
(setq LayList '(
"0"
"*|B-150U50-54";
"*|B-150Z150-54"
"*|B-###S*'"
"*|B-###T*"
"*|B-B*"
"*|B-CLheadwall"
"*|B-Cloud"
"*|B-DiagonalKicker"
"*|B-DimCoord"
"*|B-DimCoordBKG"
"*|B-Logo"
"*|B-SoffitSolid"
"*|B-StudDirection"
"*|B-StudSOLO"
"*|B-Symbol-*"
"*|BD-*"
"*|BDW-*"
"*|BH-*"
"*|BW-*"
"B-150U50-54";
"B-150Z150-54"
"B-###S*"
"B-###T*"
"B-B*"
"B-CLheadwall"
"B-Cloud"
"B-DiagonalKicker"
"B-DimCoord"
"B-DimCoordBKG"
"B-Logo"
"B-SoffitSolid"
"B-StudDirection"
"B-StudSOLO"
"B-Symbol-*"
"BD-*"
"BDW-*"
"BH-*"
"BW-*"));
(foreach x LayList
(setq LayName (strcat x))
(command "layer" "off" LayName "" "")
);
(princ)
;clean running
) ;end defun
What I mean is, each layer is being turned off but it's running a command for each layer, first Xref based and then drawing based, which takes forever due to the amount of layers.
If you require anything more just ask and I'll be more than happy to help you -Help me!
Thanks in advance for all of your hard work and help.
David J. Ortega
3D BIM Coordinator
Brady Company/Los Angeles, Inc.
AutoCAD 2011 | AutoCAD Architecture 2011 | Revit Architecture 2011 | NavisWorks Manage 2011
RE: Creating LiSP to isolate drawing layers w/ & w/out Xrefs
two syntax comments;
-shouldn't have a semicolon after layer name "*|B-150U50-54";
and
the 2 lines:
(setq LayName (strcat x))
(command "layer" "off" LayName "" "")
can be simplified to
(command "layer" "off" x "" "")
Could you cut the list in half; for examplwe
**BH-*" would handle "BH-*" and "*|BH-*"?
..or would that affect other layers?
Another thought, you can feed the layer command a string of layers separated by commas, so maybe a variable like:
(setq LongLayername "0,*|B-150U50-54,*|B-150Z150-54,*|B-###S*',*|B-###T*,
*|B-B*,
*|B-CLheadwall,
*|B-Cloud"u,etc...")
Then you'd need just one command
(command "layer" "off" Longlayername "" "")
RE: Creating LiSP to isolate drawing layers w/ & w/out Xrefs
(foreach x LayList
(setq LayName (strcat x))
(command "layer" "off" LayName "" "")
);
keep the layer command active with:
(command "layer")
(foreach x LayList
(command "off" x)
);
(command "" "")
RE: Creating LiSP to isolate drawing layers w/ & w/out Xrefs
Thanks for your help on this, I'll keep you posted.
If I wanted to learn LiSP and get a good understanding of how to use it to it's fullest potential, what might I read, use and do?
David J. Ortega
3D BIM Coordinator
Brady Company/Los Angeles, Inc.
AutoCAD 2011 | AutoCAD Architecture 2011 | Revit Architecture 2011 | NavisWorks Manage 2011
RE: Creating LiSP to isolate drawing layers w/ & w/out Xrefs
Learn lisp just like you are doing-
-review other code
-experiment writing your own
-visit & ask questions at forums-cadtutor, theswamp.org, Autodesk,
www.afralisp.com is a good reference, and several other sites.
Good luck!
RE: Creating LiSP to isolate drawing layers w/ & w/out Xrefs
Here's the correct website:
www.afralisp.net
David J. Ortega
3D BIM Coordinator
Brady Company/Los Angeles, Inc.
AutoCAD 2011 | AutoCAD Architecture 2011 | Revit Architecture 2011 | NavisWorks Manage 2011