Jump to content

Help creating an expanding Dynamic Block


muzicman82

Recommended Posts

Hi all,
 
I'm not new to AutoCAD but I've honestly never created a dynamic block and don't know what I need to do. I've watched a few tutorials on dynamic blocks but what I am trying to do seems a little different than the typical use-case.
 
I do a lot of audio-visual one-line drawings in AutoCAD. I have device equipment blocks showing all input and output connectors. I manually make them for every device but am looking to have a go-to generic dynamic block for one-off simple devices.
 
Here are examples of finished manually created blocks:
 
image.png.4b3cf2a1764d911ab3a13ba7262673e0.pngimage.png.ba9dd32e92c463175baf61a1a8b8f961.png
 
However, what I am looking for is a block that dynamically transform from this:
image.png.44436fc3d990fd44c4be2fe6c6b6fae3.png
To this:
image.png.4355804ae392e926602cd22fb6d44649.png
 
Ideally, block parameters would define how many "lines" of connections there is. Or, I am guessing there is a way for the block to be stretched such that the lines of connections become visible, but I do not want free stretch. The bottom edge of the rectangle should be a specific spacing from the middle of the last line of text. I'm sure the text could be shown or hidden with visibility, but then I don't understand how I'd resize the rectangle as required. 
 
Attributes can allow text for NAME and CONN for each IN/OUT. The manufacturer, model, and DEV_ID are all attributes. 
If for example there are a different number of inputs/outputs, I imagine just leaving the text attributes blank is enough to effectively hide them. 
 
If there's videos on doing this sort of dynamic block, links are appreciated. Most of the videos I've found are discussing layout/graphic objects. 
 
Thanks!
Link to comment
Share on other sites

To me that looks like a table. Have you looked into modifying a table style? Have you done any programming? Do you ever make these blocks smaller instead of larger? Is there an upper limit on the number of rows? Are there different colors for wires that have different functions?

Link to comment
Share on other sites

Just now, CyberAngel said:

To me that looks like a table. Have you looked into modifying a table style? Have you done any programming? Do you ever make these blocks smaller instead of larger? Is there an upper limit on the number of rows? Are there different colors for wires that have different functions?

 

They look like a table, but they are never drawn like tables. The wires are drawn in separate from the blocks. The blocks are often as small as 1x in and 1x out, or something there's just 1x input or 1x output. I've done programming but not AutoLISP... I don't have an upper limit but I think larger blocks would still get drawn manually, just because they often have more complex layouts. 

 

My thinking for the dynamic block is that I could always start it with it, and hopefully explode it with values and then modify as necessary. 

 

Here's a more complicated example:

image.png.bb70a4681733ff0b39bf0248bee51543.png

Link to comment
Share on other sites

Dynamic blocks are intended to be used with geometry (lines, arcs, etc.) Although you might possibly be able to array text items you certainly cannot array attributes (at least not in any usable form). If you are using full Autocad it might be worth seeing what the users in the Lisp section might be able to see as options but as far as dynamic blocks go I would forget the idea, unless you have a defined set of devices with numbers of inputs/outputs that could be constructed individually and placed in a block with visibility states. Other than that you are just asking for a headache and I would save my efforts for better use.

Don't get me wrong the idea looks great but in my humble opinion completely unworkable for a dynamic block (other than visibility states)

Link to comment
Share on other sites

Like others "insertrows" in a table is the simple way to go, just keep adding rows and populating cells the Aux with lines not sure may be able to cheat a little with | and _.

 

I did like 1000 rows in one project I had a go at so its possible. 

 

Happy to provide example code.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...