Currently, I'm redoing all the customization files of autocad for the office I'm working in. So far so good, I've pretty much everything sorted out. Although there's one small thing that I cannot figure out:
We have been having problems with the fact that some people in the past inserted blocks (from the library) in drawings on non-printable layers. You don't see that in modelspace (since the layers in the block are printable), but as soon as you try to print, the blocks are invisible. And to be honest: it's a pain in the ass (as well as rather stressful and prone to mistakes) to check that all by hand.
So I was hoping to insert a lisp routine that automatically places all blocks on a certain layer (i.e. 0_blocks), while keeping the contents on their original layer. Whether that is done automatically on inserting, or that there is a keyboard shortcut for organizing this...
It would, of course, even be better if a block with a specific code would be placed on the matchin layer (i.e. block 23_steel beam ends up on layer 23_steel construction)...
Well, I've found LSP-routines all over the internet for placing the contents of the blocks on a specific layer, but not for placing the definition of the block on a certain layer... Is there anybody who can help me out with this one?
Eh -- I am sorry but I shuldn't offer an advise when my Acad is not up and running, -- but the way you describe the problem make me wonder if your problem could be a compleatly different one than you think.
I remember that for plotting particular items you has to check those to be plottet , -- my reoly there allway's was "All" and then next step plotting the drawing was no problem.
Sorry I can't describe it more in detail, but these things are done by automatic when you first realised you has to point out the items and blocks at this specific time , and frankly without my AutoCAD running at the moment, I can't help with more than this advise.
As Layers for me are either frozen or locked if they make trouble and I don'y think the layers are your problem. Caurse if it is not you typically been raging around in one of these dead ends, that AutoCAD offer.
Pretty much, a-f is correct. And this works like a charm, when done by hand. However, Qselect is only accessible via a pop-up (dialogue screen), making it impossible to use in a lisp-file. I've tried the old SSX.LSP to create a selection set of all blocks, but to no avail...
Emailing them, giving them a stern talking to, slapping them across the face... none of it seems to work. Also, there have been some rather sloppy interns and employees in the past...
Well, for now I just settle with writing an e-mail that says "if you have this problem, type qselect, select all blocks; then type laymch and chose "name" and then the name of the layer on which the blocks should be. It's not the prettiest solution, but it should suffice...
I use a custom menu to do it. All of this is in my own MNS file.
First I use the USERR1 variable to set my working scale so that the blocks are all at the correct size relative to the output scale. This also sets my working dimension and text scales.
Then I use this line of code to insert blocks. This line creates my target insertion layer (A-NOTES2 in this case) inserts my block (el_Datum) at the preselected scale
---------Begin code insert for block insertion pulldown menu--------------------
[Elevation Control Datum]^C^C^C-LAYER;MAKE;A-NOTES2;;-INSERT;blocks/_el-Datum;sc;(getvar "userr1");
---------End code insert--------------------
The only drawback is that your current layer gets changed in the process to the layer the block is inserted on. I have been meaning to fix this for some time by grabbing the current layer before the operation as a variable and switching back to it after the operation but have never rewrote my MNS file for it… There is a lot of stuff in my MNS…
Let me know if you have any questions. I could email you a sample MNS if you want to learn it by reverse engineering it.
thanks threshold, that is really helpful... At this moment it is still a bit too complex for me to grasp completely, but I am going to use this to work the other way around. it really helps me out!
LSP file for inserting block in ACAD
Currently, I'm redoing all the customization files of autocad for the office I'm working in. So far so good, I've pretty much everything sorted out. Although there's one small thing that I cannot figure out:
We have been having problems with the fact that some people in the past inserted blocks (from the library) in drawings on non-printable layers. You don't see that in modelspace (since the layers in the block are printable), but as soon as you try to print, the blocks are invisible. And to be honest: it's a pain in the ass (as well as rather stressful and prone to mistakes) to check that all by hand.
So I was hoping to insert a lisp routine that automatically places all blocks on a certain layer (i.e. 0_blocks), while keeping the contents on their original layer. Whether that is done automatically on inserting, or that there is a keyboard shortcut for organizing this...
It would, of course, even be better if a block with a specific code would be placed on the matchin layer (i.e. block 23_steel beam ends up on layer 23_steel construction)...
Well, I've found LSP-routines all over the internet for placing the contents of the blocks on a specific layer, but not for placing the definition of the block on a certain layer... Is there anybody who can help me out with this one?
Eh -- I am sorry but I shuldn't offer an advise when my Acad is not up and running, -- but the way you describe the problem make me wonder if your problem could be a compleatly different one than you think.
I remember that for plotting particular items you has to check those to be plottet , -- my reoly there allway's was "All" and then next step plotting the drawing was no problem.
Sorry I can't describe it more in detail, but these things are done by automatic when you first realised you has to point out the items and blocks at this specific time , and frankly without my AutoCAD running at the moment, I can't help with more than this advise.
As Layers for me are either frozen or locked if they make trouble and I don'y think the layers are your problem. Caurse if it is not you typically been raging around in one of these dead ends, that AutoCAD offer.
- What do you need that Lisp for anyway ?
QSELECT (or FILTER) to select all blocks, then just change the layer for the selection.
I don't know if that will work though, don't blocks still reference back to the layer they were inserted on? Something weird like that.
Pretty much, a-f is correct. And this works like a charm, when done by hand. However, Qselect is only accessible via a pop-up (dialogue screen), making it impossible to use in a lisp-file. I've tried the old SSX.LSP to create a selection set of all blocks, but to no avail...
how bout an email suggesting that people insert the block on the proper layer?
Emailing them, giving them a stern talking to, slapping them across the face... none of it seems to work. Also, there have been some rather sloppy interns and employees in the past...
Well, for now I just settle with writing an e-mail that says "if you have this problem, type qselect, select all blocks; then type laymch and chose "name" and then the name of the layer on which the blocks should be. It's not the prettiest solution, but it should suffice...
It's easy to write a Lisp that Explode all blocks within blocks within blocks He He He.
I use a custom menu to do it. All of this is in my own MNS file.
First I use the USERR1 variable to set my working scale so that the blocks are all at the correct size relative to the output scale. This also sets my working dimension and text scales.
---------Begin code insert for working scale pulldown menu--------------------
[$(eval,"Current Scale Factor =" $(rtos,$(getvar,userr1),2,0))]^C^C^C
[->Set Drawing Scale]
[$(if,$(eq,$(getvar,userr1),1536),!.)1/128"=1'-0"]^C^C^C^Puserr1;1536;DIMSCALE;1536;TEXTSTYLE;archb;TEXTSIZE;128";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),768),!.)1/64"=1'-0"]^C^C^C^Puserr1;768;DIMSCALE;768;TEXTSTYLE;archb;TEXTSIZE;64";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),384),!.)1/32"=1'-0"]^C^C^C^Puserr1;384;DIMSCALE;384;TEXTSTYLE;archb;TEXTSIZE;32";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),192),!.)1/16"=1'-0"]^C^C^C^Puserr1;192;DIMSCALE;192;TEXTSTYLE;archb;TEXTSIZE;16";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),128),!.)3/32"=1'-0"]^C^C^C^Puserr1;128;DIMSCALE;128;TEXTSTYLE;archb;TEXTSIZE;10.66624";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),96),!.)1/8" =1'-0"]^C^C^C^Puserr1;96;DIMSCALE;96;TEXTSTYLE;archb;TEXTSIZE;8";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),64),!.)3/16"=1'-0"]^C^C^C^Puserr1;64;DIMSCALE;64;TEXTSTYLE;archb;TEXTSIZE;5.33312";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),48),!.)1/4" =1'-0"]^C^C^C^Puserr1;48;DIMSCALE;48;TEXTSTYLE;archb;TEXTSIZE;4";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),32),!.)3/8" =1'-0"]^C^C^C^Puserr1;32;DIMSCALE;32;TEXTSTYLE;archb;TEXTSIZE;2.66656";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),24),!.)1/2" =1'-0"]^C^C^C^Puserr1;24;DIMSCALE;24;TEXTSTYLE;archb;TEXTSIZE;1.99992";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),16),!.)3/4" =1'-0"]^C^C^C^Puserr1;16;DIMSCALE;16;TEXTSTYLE;archb;TEXTSIZE;1.3328";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),12),!.)1" =1'-0"]^C^C^C^Puserr1;12;DIMSCALE;12;TEXTSTYLE;archb;TEXTSIZE;.99996";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),8),!.)1 1/2"=1'-0"]^C^C^C^Puserr1;8;DIMSCALE;8;TEXTSTYLE;archb;TEXTSIZE;.66664";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),4),!.)3"=1'-0"]^C^C^C^Puserr1;4;DIMSCALE;4;TEXTSTYLE;archb;TEXTSIZE;.33332";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),2),!.)6"=1'-0"]^C^C^C^Puserr1;2;DIMSCALE;2;TEXTSTYLE;archb;TEXTSIZE;.16667";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),1),!.)1'=1'-0"]^C^C^C^Puserr1;1;DIMSCALE;1;TEXTSTYLE;archb;TEXTSIZE;.08333";DIMTXT;1/16"
[--]
[$(if,$(eq,$(getvar,userr1),120),!.)1"=10']^C^C^C^Puserr1;120;DIMSCALE;120;TEXTSTYLE;archb;TEXTSIZE;9.9996";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),192),!.)1"=16']^C^C^C^Puserr1;192;DIMSCALE;192;TEXTSTYLE;archb;TEXTSIZE;15.99936";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),240),!.)1"=20']^C^C^C^Puserr1;240;DIMSCALE;240;TEXTSTYLE;archb;TEXTSIZE;19.9992";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),360),!.)1"=30']^C^C^C^Puserr1;360;DIMSCALE;360;TEXTSTYLE;archb;TEXTSIZE;29.9988";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),480),!.)1"=40']^C^C^C^Puserr1;480;DIMSCALE;480;TEXTSTYLE;archb;TEXTSIZE;39.9984";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),600),!.)1"=50']^C^C^C^Puserr1;600;DIMSCALE;600;TEXTSTYLE;archb;TEXTSIZE;49.998";DIMTXT;1/16"
[$(if,$(eq,$(getvar,userr1),720),!.)1"=60']^C^C^C^Puserr1;720;DIMSCALE;720;TEXTSTYLE;archb;TEXTSIZE;59.9976";DIMTXT;1/16"
[<-$(if,$(eq,$(getvar,userr1),1200),!.)1"=100']^C^C^C^Puserr1;1200;DIMSCALE;1200;TEXTSTYLE;archb;TEXTSIZE;99.996";DIMTXT;1/16"
---------End code insert--------------------
Then I use this line of code to insert blocks. This line creates my target insertion layer (A-NOTES2 in this case) inserts my block (el_Datum) at the preselected scale
---------Begin code insert for block insertion pulldown menu--------------------
[Elevation Control Datum]^C^C^C-LAYER;MAKE;A-NOTES2;;-INSERT;blocks/_el-Datum;sc;(getvar "userr1");
---------End code insert--------------------
The only drawback is that your current layer gets changed in the process to the layer the block is inserted on. I have been meaning to fix this for some time by grabbing the current layer before the operation as a variable and switching back to it after the operation but have never rewrote my MNS file for it… There is a lot of stuff in my MNS…
Let me know if you have any questions. I could email you a sample MNS if you want to learn it by reverse engineering it.
thanks threshold, that is really helpful... At this moment it is still a bit too complex for me to grasp completely, but I am going to use this to work the other way around. it really helps me out!
Once you have the code above it is all cut and paste. If you want me to email a sample MNS with instructions on how to load it into ACAD let me know.
- Dave
Block this user
Are you sure you want to block this user and hide all related comments throughout the site?
Archinect
This is your first comment on Archinect. Your comment will be visible once approved.