Hello guys,
I would like to write an code to change automatically the structure label style while moving the mouse. I have set two labels styles: left and right. The label style would be set according the structure position: left style at left structure side and right style at right structure side.
Nowadays I need to position it manually and the change the label style property (see the screencast). But we can have thousands of structures and I would like to do it more dynamically.
SCREENCAST: http://autode.sk/2bKW57x
So, how can I get the labels move events, change their styles while moving it and show this results also while moving? I already know the code to determine when it should be left or right style but, again, not dynamically.
Thanks a lot,
Well I think the SincPac might have this functionality in the future. Many of the other label styles are already included in the SPAddLabels command. I wrote the command.
So to do this you'll want an entity Jig. A Google search will provide numerous examples. I like the ones from Through the Interface and spiderinnet1.typepad.com/blog/
Then store the styles you want to use as xrecord data for each style you want to use.
Then as you use the entity jig grab the xrecord data and change the style to the one you want to use. You'll do this by checking the insert point to the drag location and choosing which label style to use. This is the hardest part for rotated viewports.
All of the pieces of code required are out there, it's just a matter of putting it all together.
Hello @Civil3DReminders_com,
Thanks for your reply. I started to search at Through the Interface blog and I found a lot of interesting things like jig, custom objects and events handlers.
I'll try and I'll post here the final source code (I hope, at least).
Thanks,
Some additional information on this topic. The label has two properties to show location. One is the location of the label and the other is the location of the label being dragged. Note the location of where the label is being dragged will probably throw an exception if the structure label is above the structure since it doesn't have a dragged value. I usually watch the label in debug mode to make sure I've got the correct label property. No grabbing of AutoCAD grips is needed.
You set the property of the location.
http://adndevblog.typepad.com/infrastructure/2015/07/using-jig-with-civil-3d-labels.html