TheSwamp

CAD Forums => CAD General => Dynamic Blocks => Topic started by: M-dub on March 12, 2009, 10:03:42 AM

Title: Wire / Cable Label
Post by: M-dub on March 12, 2009, 10:03:42 AM
Before I attempt to create this myself, I just thought I'd check to see if anyone has something similar already and would be willing to share.

I've been meaning to do something like this for a VERY long time.  I guess you could call it a leader with a dynamic 'arrowhead'.

This is what I'm after.  A wire / cable label that allows me to stretch the components depending on how many wires are being labelled.  I would also like to be able to stretch the leader component.

Would I need to have two separate blocks to deal with the justification of the text?  (MR vs ML).

Any ideas?

Thanks a lot
Title: Re: Wire / Cable Label
Post by: Matt__W on March 12, 2009, 11:16:42 AM
Here you go.  It'll get you started.
Title: Re: Wire / Cable Label
Post by: M-dub on March 12, 2009, 11:25:08 AM
Thanks Matt...
I'm working on it right now.

Still haven't exactly figured everything out about dynamic blocks yet...
Title: Re: Wire / Cable Label
Post by: M-dub on March 12, 2009, 11:43:31 AM
I take it Text Justification is not a Dynamic Parameter that can be set.

For what it's worth, I'm pretty sure it will be MUCH easier to creat two separate blocks; one for right justified text and one for left.
Title: Re: Wire / Cable Label
Post by: James Cannon on March 12, 2009, 12:05:32 PM
I take it Text Justification is not a Dynamic Parameter that can be set.

For what it's worth, I'm pretty sure it will be MUCH easier to creat two separate blocks; one for right justified text and one for left.

Haven't fudged with it for text yet, but there is a "mirror" action for dyn blocks.

Otherwise, worst case, create a "visibility set" for left versus right, and have the label show up in both (so you don't have to re-stretch it if you switch sides, later) and then you can toggle left or right.
Title: Re: Wire / Cable Label
Post by: Atook on March 12, 2009, 12:21:43 PM
This could be useful for pipe sizes too, can you post what you come with for a solution?
Title: Re: Wire / Cable Label
Post by: ronjonp on March 12, 2009, 12:35:50 PM
This could be useful for pipe sizes too, can you post what you come with for a solution?

Don't do it!! You know the dynamic block will break  :-P
Title: Re: Wire / Cable Label
Post by: M-dub on March 12, 2009, 12:58:08 PM
Otherwise, worst case, create a "visibility set" for left versus right, and have the label show up in both (so you don't have to re-stretch it if you switch sides, later) and then you can toggle left or right.

That's what I was thinking about, but ... Well, once I get this one done (just got back from lunch), that might go into version 2.

This could be useful for pipe sizes too, can you post what you come with for a solution?

I was planning on it.  :)
Title: Re: Wire / Cable Label
Post by: Krushert on March 12, 2009, 01:02:14 PM
I take it Text Justification is not a Dynamic Parameter that can be set.

For what it's worth, I'm pretty sure it will be MUCH easier to creat two separate blocks; one for right justified text and one for left.

I am curious too about the justification.  I am trying to get it to work in another block.
Title: Re: Wire / Cable Label
Post by: M-dub on March 12, 2009, 01:08:23 PM
I was thinking the justification would have to be based on some reactor or something, but "Good luck with that, self!"  :P
Title: Re: Wire / Cable Label
Post by: Kate M on March 12, 2009, 01:38:43 PM
I take it Text Justification is not a Dynamic Parameter that can be set.

For what it's worth, I'm pretty sure it will be MUCH easier to creat two separate blocks; one for right justified text and one for left.

I am curious too about the justification.  I am trying to get it to work in another block.
Unfortunately justification doesn't change with the flip action. (At least for single-line attributes -- I haven't tested multiline.) What you can do is have an invisible attribute that you fill in, then two pieces of text that reference the attribute with the appropriate justification. You still have to control it with a visibility state, though.
Title: Re: Wire / Cable Label
Post by: M-dub on March 12, 2009, 01:51:52 PM
That sounds like it might work too, Kate.

Working on this thing again... Sheesh!  Everyone here seems to have saved their drawing requests for today, when I'm the only CAD guy in the office!
Title: Re: Wire / Cable Label
Post by: M-dub on March 12, 2009, 02:07:06 PM
Ok, this is going to make me sound really novice, but I have never really used the Block Editor.

EDIT:  I figured it out... BSAVEAS, then Check the 'Save block definition to drawing file' box.  (Uploaded file updated)

Here's the newbie question:  (For what I anticipate is going to be a very simple answer, the problem is hard to explain, but I'll try)
How do I get the block I created in the block editor ... to ... work right?

I'm in a dwg file, which I THOUGHT was going to be the block.  Well, it IS, but when I go to insert it into another drawing, the DYNAMIC block is nested inside the dwg file I've saved.

In my whole CAD career, I've only ever used WBLOCK to create my blocks... or create them from scratch in a new dwg.
Here... have a look.  Then, we'll talk about why I can't get the attribute to stretch with the line work.
Title: Re: Wire / Cable Label
Post by: M-dub on March 12, 2009, 02:34:29 PM
Now, that the above problem is fixed, does anyone know why the attribute in the block won't move / stretch with the dynamic grips?
Title: Re: Wire / Cable Label
Post by: Kate M on March 12, 2009, 02:53:26 PM
Since the block editor was introduced, many people prefer to their blocks in a "container" drawing, which makes it easy to pull blocks in from DesignCenter or a tool palette, but difficult to use the "insert" command. (Personally, I don't miss insert.) To see what I mean, I'm sending your block back in a container drawing. This also gets rid of the "M-ELECT-CableLabel.dwg contains authoring elements. Open in Block Editor?" message, and makes "Save block definition to drawing file" unnecessary.

The reason your text isn't moving with the line is that it's not included in your stretch action's selection set. It's a quirk of dynamic block stretches that defining the window and selecting the objects are two separate events. I added the text to Distance2's stretch, and the text and Distance2 to Distance1's stretch. (It's okay -- and often good -- to include parameters in an action's selection set. Much less often is it good to include an action in a selection set.)

I'll let you keep playing with the attributes/fields/visibility states... :wink:


Title: Re: Wire / Cable Label
Post by: M-dub on March 12, 2009, 03:19:03 PM
Thanks Kate, but it didn't work any differently from the one that I had.  The attribute still stays put.  :?

Maybe I'm old fashioned and behind the times, but I'm still attached to my old DDI (DDINSERT) command.  That doesn't mean the 'container drawing' isn't a good idea but my personal preference is for the old way.  :oops:
Title: Re: Wire / Cable Label
Post by: Kate M on March 12, 2009, 04:48:49 PM
Really? I just downloaded the drawing, opened it, and the attribute moved.

You'll be converted to tool palettes eventually. ;-)
Title: Re: Wire / Cable Label
Post by: M-dub on March 13, 2009, 10:10:00 AM
Really? I just downloaded the drawing, opened it, and the attribute moved.
My bad... I brought it into the same drawing I was working on and it was still referring to the old definition.

You'll be converted to tool palettes eventually. ;-)
You could be right... to be honest, I just haven't tried to use it because there's never been a need.
Title: Re: Wire / Cable Label
Post by: M-dub on March 13, 2009, 10:47:51 AM
What you can do is have an invisible attribute that you fill in, then two pieces of text that reference the attribute with the appropriate justification. You still have to control it with a visibility state, though.

Sorry to keep bothing you but when you say 'text that references the attribute', do you mean MTEXT, Field, dtext, ?  I've never had a requirement for this before and therefore, don't know how to accomplish it.  I want to figure it out for myself, but this has stumped me a bit.
Title: Re: Wire / Cable Label
Post by: James Cannon on March 13, 2009, 10:59:12 AM
You'll be converted to tool palettes eventually. ;-)

I found it immensely offputting when I set up my tool pallette decently, and then tried to figure out how to have it shared across the network.

Might've been me.

I'm actually putting in the work to create 'insert' macros for all my blocks and creating a Ribbon tab for the block library... each tab for each discipline/section.  Yea, it's a bit more work up front, but managing partial-CUIs is awesomely more awesome than managing Tool Pallettes... but again, it may be my faults and ignorance of tool pallettes.
Title: Re: Wire / Cable Label
Post by: Kate M on March 13, 2009, 01:29:53 PM
What you can do is have an invisible attribute that you fill in, then two pieces of text that reference the attribute with the appropriate justification. You still have to control it with a visibility state, though.

Sorry to keep bothing you but when you say 'text that references the attribute', do you mean MTEXT, Field, dtext, ?  I've never had a requirement for this before and therefore, don't know how to accomplish it.  I want to figure it out for myself, but this has stumped me a bit.
Y'know, I swear this should be possible with a combination of fields, attributes, and text, but every time I think I know how it works, I get tripped up again. So if somebody knows how to do it, speak up...in the meantime I'll keep looking.
Title: Re: Wire / Cable Label
Post by: Kate M on March 13, 2009, 01:31:24 PM
You'll be converted to tool palettes eventually. ;-)

I found it immensely offputting when I set up my tool pallette decently, and then tried to figure out how to have it shared across the network.
All I ever had to do was create them on one machine, export them to a network folder, and point the other computers to that folder. I know some people have had nightmares (and that it's not as easy in vertical products), but I never had a problem...
Title: Re: Wire / Cable Label
Post by: M-dub on March 13, 2009, 01:36:54 PM
I thought there was a way to do it too.  I seem to remember a conversation about attributes and how you could enter the value once and have it show up in a number of locations.

I THOUGHT I had it with a field looking at the value of the attribute, but that attribute has to be in a block and the field can not be in the same block.  Might work if the attribute was nested, but then you can't enter the value unless you explode it.

Thanks though, Kate.
Title: Re: Wire / Cable Label
Post by: M-dub on March 13, 2009, 01:57:09 PM
Anyway, here's a drawing with both blocks for left and right justified text if anyone wants 'em.
Title: Re: Wire / Cable Label
Post by: Crank on March 14, 2009, 09:26:01 AM
I would have done it like attached file.

There is however one small problem because of an Autocad bug :( : If you edit the attribute and the length of the new string changes, the attribute must be on the left site, because otherwise the insertionpoint of the attribute moves.
Title: Re: Wire / Cable Label
Post by: M-dub on March 16, 2009, 10:04:26 AM
Thanks Crank.  That has potential for sure... I'm busy for the next couple of days, but would like to dessect yours to see how it was made.

Thanks again
Title: Re: Wire / Cable Label
Post by: M-dub on March 24, 2009, 10:57:39 AM
Just out of curiosity, has anyone ever tried using a dynamic block as a custom arrowhead on a leader?
Title: Re: Wire / Cable Label
Post by: M-dub on March 24, 2009, 11:00:54 AM
It doesn't work.  :(
Title: Re: Wire / Cable Label
Post by: M-dub on March 24, 2009, 04:01:37 PM
Here's an updated version... With Multi-line Attributes
(See attached zip)

I wish I had time to figure out how to accomplish all of this with one single block.  That's why I was asking if it was possible to use a dynamic block for a custom leader arrowhead.
Title: Re: Wire / Cable Label
Post by: Matt__W on March 24, 2009, 04:15:46 PM
Maybe this will get you going in the right direction?  This will eliminate the left & right justified blocks.
Title: Re: Wire / Cable Label
Post by: Kate M on March 24, 2009, 04:36:31 PM
Maybe this will get you going in the right direction?  This will eliminate the left & right justified blocks.
Sweet...I didn't realize that all you had to do to fix the flipping problem was use a multiline attribute!

(Although next time use a container drawing, please! :police:)
Title: Re: Wire / Cable Label
Post by: Matt__W on March 24, 2009, 04:47:13 PM
I'm working on another one that uses a vis-state to display the horizontal label. 
Title: Re: Wire / Cable Label
Post by: Kate M on March 24, 2009, 04:56:52 PM
I made this one, with a rotation parameter...it all works except the horizontal-right-justified.
Title: Re: Wire / Cable Label
Post by: M-dub on March 25, 2009, 08:45:11 AM
Maybe this will get you going in the right direction?  This will eliminate the left & right justified blocks.
Sweet...I didn't realize that all you had to do to fix the flipping problem was use a multiline attribute!

That is certainly a nice byproduct of the multiline attribute!  Learning about all kinds of goodies today!  :)

That flip is really nice!

I'm now going to rip it apart to try and figure out how they work.  I wish I could turn the parameters and actions off and on like layers... or put them on layers to achieve the same thing.  Not a big deal though.

Thanks Matt & Kate!
Title: Re: Wire / Cable Label
Post by: Matt__W on March 25, 2009, 08:56:36 AM
And here's my vertical/horizontal/flippable cable label (in a container drawing).
Title: Re: Wire / Cable Label
Post by: M-dub on March 25, 2009, 09:05:47 AM
Nice!  :)
Title: Re: Wire / Cable Label
Post by: M-dub on March 25, 2009, 12:51:16 PM
Matt, do you know if there's a way to anchor everything to the basepoint of the block when switching from vertical to horizontal?
Title: Re: Wire / Cable Label
Post by: Matt__W on March 25, 2009, 01:23:29 PM
Matt, do you know if there's a way to anchor everything to the basepoint of the block when switching from vertical to horizontal?
What do you mean??
Title: Re: Wire / Cable Label
Post by: M-dub on March 25, 2009, 01:35:47 PM
I don't think it will be possible (easy).

Maybe easier with a pic?

Note the basepoint shown in red.  The basepoint of the block is in the centrepoint of the 'bottom' arc of the 'ellipse'.  Is there any way to anchor everything to that point when toggling it?

Does that make any more sense?
Title: Re: Wire / Cable Label
Post by: Matt__W on March 25, 2009, 01:40:41 PM
I don't think there is a way.

I see what you're saying though.  If there weren't so many different moving parts it probably wouldn't look so bad.
Title: Re: Wire / Cable Label
Post by: M-dub on March 25, 2009, 01:45:16 PM
Yeah, I hear ya.

All of this could be avoided if I was able to use JUST the dynamic ellipse portion as a custom leader arrowhead because ideally, that's what I'm after.  The flexibility of the leader, with the dynamic ellipse to be able to change size depending on how many wires / cables I need to include.

Thanks though, Matt.  These are awesome.  :)
Title: Re: Wire / Cable Label
Post by: Matt__W on March 25, 2009, 02:27:50 PM
Here's an updated block.  I'm still trying to get a few of the kinks out.... My brain is locking up right now - it's probably something really obvious.  You'll see what I mean when you start stretching the loop at an angle.
Title: Re: Wire / Cable Label
Post by: M-dub on March 25, 2009, 02:55:11 PM
Awesomer!

And yes, I see what you mean.  :)
Title: Re: Wire / Cable Label
Post by: HasanCAD on July 15, 2010, 04:31:42 AM
Updated
Title: Re: Wire / Cable Label
Post by: Keith™ on July 15, 2010, 09:16:08 AM
The block provided by Kate should handle all of your specific needs, In order to get the text on the opposite side of the oval, you merely have to insert the block, fill in the attribute and mirror it along the center axis ... of course Autodesk broke some of the attribute stuff when then introduced 2008 (presumably for the annotation functionality) ... it has been that way since ... anyway, the attribute will mirror properly, but it won't work properly if you edit it after mirroring. at least in my tests.
Title: Re: Wire / Cable Label
Post by: M-dub on November 28, 2011, 10:44:42 AM
This is why I'm afraid of using dynamic blocks.  This wouldn't have happened with our old stuff. :(

It could just be an issue with the multiline attribute, but ... whatever.  This is poopy.
Title: Re: Wire / Cable Label
Post by: M-dub on November 28, 2011, 11:06:40 AM
This could be useful for pipe sizes too, can you post what you come with for a solution?

Don't do it!! You know the dynamic block will break  :-P

:(
Title: Re: Wire / Cable Label
Post by: Jeff H on November 28, 2011, 11:52:28 AM
If it is not that many just go in block editor and for the Attribute set Lock Position = No and move them over?
 :'( 
Title: Re: Wire / Cable Label
Post by: M-dub on November 28, 2011, 11:56:41 AM
If it is not that many just go in block editor and for the Attribute set Lock Position = No and move them over?
 :'( 

Going to look into it this afternoon.  Thanks for the tip.
It's like the multiline attribute got messed up and changed to lower left / right justification from middle left / right.
Title: Re: Wire / Cable Label
Post by: M-dub on December 19, 2011, 09:54:48 AM
So, I just figured out what happened with these blocks.  The ones on the right side of the terminal strips were mirrored instead of being flipped.  I don't know if it was me who did it, but I don't think I would've predicted this behavior.

To fix them, I mirrored them back, did a redefine, then went back and flipped them all and everything is ok.

I wonder if there's a way to prevent a block from being mirrored...
Title: Re: Wire / Cable Label
Post by: Nibster on December 19, 2011, 01:07:18 PM
So, I just figured out what happened with these blocks.  The ones on the right side of the terminal strips were mirrored instead of being flipped.  I don't know if it was me who did it, but I don't think I would've predicted this behavior.

To fix them, I mirrored them back, did a redefine, then went back and flipped them all and everything is ok.

I wonder if there's a way to prevent a block from being mirrored...
only with a reactor to filter out those blocks
Title: Re: Wire / Cable Label
Post by: M-dub on December 19, 2011, 01:25:53 PM
So, I just figured out what happened with these blocks.  The ones on the right side of the terminal strips were mirrored instead of being flipped.  I don't know if it was me who did it, but I don't think I would've predicted this behavior.

To fix them, I mirrored them back, did a redefine, then went back and flipped them all and everything is ok.

I wonder if there's a way to prevent a block from being mirrored...
only with a reactor to filter out those blocks
That's what I was afraid of.
Oh well... I just hope I can keep this in mind for future reference.
Title: Re: Wire / Cable Label
Post by: M-dub on December 19, 2011, 01:29:07 PM
On second thought, what do you guys think of adding an invisible attribute reminding users not to mirror that block?
A bit nasty, but might get the job done.
Title: Re: Wire / Cable Label
Post by: Matt__W on December 19, 2011, 01:43:39 PM
Hard to see if it's invisible, dontcha think?
Title: Re: Wire / Cable Label
Post by: M-dub on December 19, 2011, 01:49:31 PM
Hard to see if it's invisible, dontcha think?
Not when you insert it or when you're editing the attributes...
Title: Re: Wire / Cable Label
Post by: Keith™ on December 19, 2011, 01:59:06 PM
You could simply redefine the mirror command to filter out the blocks. At a previous job we did this to prevent certain blocks from being mirrored. Of course the default command can always be called from lisp so it isn't 100% fail-proof.

You could create a custom action in a redefined mirror command that flips the block instead of mirrors it then it would be seamless to the user.
Title: Re: Wire / Cable Label
Post by: Jeff H on December 19, 2011, 03:23:15 PM
Hard to see if it's invisible, dontcha think?
Not when you insert it or when you're editing the attributes...
Or
 ATTDISP = ON
or
ATTMODE = 2
Title: Re: Wire / Cable Label
Post by: M-dub on December 19, 2011, 03:46:48 PM
Hard to see if it's invisible, dontcha think?
Not when you insert it or when you're editing the attributes...
Or
 ATTDISP = ON
or
ATTMODE = 2

Ok, ya got me.  If people are messing around with those variables, they're going to have more than just this block screwed up.  We've got a LOT of blocks with attributes.  Several with invisible attributes...