Author Topic: Insert block - variable size  (Read 1403 times)

0 Members and 1 Guest are viewing this topic.

like_citrus

  • Newt
  • Posts: 114
Insert block - variable size
« on: November 20, 2020, 02:46:35 AM »
I have a set of blocks for different size bolts which I insert from a pull down menu. The method is described below.
I wanted to have a way that I could input what length the bolt should be.
Can this be done?
It doesn't sound easy as most lines/arcs stay the same but some change in length.


METHOD
A file exists for each block (M6.dwg, M8.dwg, M10.dwg, etc).
These CAD files, a script file and menu file (see code below) are all placed in one folder.
Then the script file is run from AutoCAD to generate the menu.
Then go to menu, choose a block and it's inserted.


SCRIPT FILE (.scr extension)
Code: [Select]
(if (and (not (findfile "STEEL.mnu"))
(findfile "C:\\Pull down menu\\POP12 Steel\\STEEL.mnu")
)
(setenv "ACAD" (strcat (getenv "ACAD") "C:\\Pull down menu\\POP12 Steel"))
)
(command "._MENULOAD" "STEEL.mnu")
(menucmd "P12=+STEEL.CTOPopSTEEL")

MENU FILE (.mnu extension)
Code: [Select]
***MENUGROUP=STRUCTURAL_STEEL
***POP12
**CTOPopSTEEL

              [Steel]

              [->Bolts]
                 [M6]^C^C(BlockInsert "Bolts_M6");scale;1;
                 [M8]^C^C(BlockInsert "Bolts_M8");scale;1;
                 [M10]^C^C(BlockInsert "Bolts_M10");scale;1;
                 [M12]^C^C(BlockInsert "Bolts_M12");scale;1;
                 [M16]^C^C(BlockInsert "Bolts_M16");scale;1;
                 [M20]^C^C(BlockInsert "Bolts_M20");scale;1;
                 [M24]^C^C(BlockInsert "Bolts_M24");scale;1;
                 [M30]^C^C(BlockInsert "Bolts_M30");scale;1;
                 [<-M36]^C^C(BlockInsert "Bolts_M36");scale;1;
              [--]


CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Insert block - variable size
« Reply #1 on: November 20, 2020, 08:30:02 AM »
I think you would need dynamic blocks of the bolts or to create then on the fly from data tables.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

like_citrus

  • Newt
  • Posts: 114
Re: Insert block - variable size
« Reply #2 on: November 20, 2020, 08:20:42 PM »
OK thanks, it looks like this is the way to go then.

BIGAL

  • Swamp Rat
  • Posts: 1398
  • 40 + years of using Autocad
Re: Insert block - variable size
« Reply #3 on: November 21, 2020, 03:04:07 AM »
have a look at this

A man who never made a mistake never made anything

like_citrus

  • Newt
  • Posts: 114
Re: Insert block - variable size
« Reply #4 on: November 21, 2020, 03:09:48 AM »
That's what I was looking for. Thanks BIGAL.

BIGAL

  • Swamp Rat
  • Posts: 1398
  • 40 + years of using Autocad
Re: Insert block - variable size
« Reply #5 on: November 21, 2020, 05:05:39 PM »
Can not take the credit was not created by me, very useful.
A man who never made a mistake never made anything