Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change Structure Label Style Event

5 REPLIES 5
Reply
Message 1 of 6
diegoal
393 Views, 5 Replies

Change Structure Label Style Event

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. 

 

Capturar.JPG

 

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,

---------------------------------------------------------------------------------------------------------
Diego Álvares
Civil Engineer @ Trento Engenharia Ltda.
www.trentoengenharia.com.br
Autocad Civil 3D 2010 to 2017 - Infrastructure Design Suite
Windows 7 64 i7 4770 @3.40GHz 8GB Ram GeForce GTX 760
Please use the Accept as Solution or Kudo buttons when appropriate
---------------------------------------------------------------------------------------------------------
5 REPLIES 5
Message 2 of 6

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. 

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
Message 3 of 6

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,

---------------------------------------------------------------------------------------------------------
Diego Álvares
Civil Engineer @ Trento Engenharia Ltda.
www.trentoengenharia.com.br
Autocad Civil 3D 2010 to 2017 - Infrastructure Design Suite
Windows 7 64 i7 4770 @3.40GHz 8GB Ram GeForce GTX 760
Please use the Accept as Solution or Kudo buttons when appropriate
---------------------------------------------------------------------------------------------------------
Message 4 of 6

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. 

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
Message 5 of 6

@Civil3DReminders.com

If i declare a variable as Point3D and set its xyz position i'll be getting the Label Insertion point right? So how do i declare the label being dragged?
Message 6 of 6

You set the property of the location. 

 

http://adndevblog.typepad.com/infrastructure/2015/07/using-jig-with-civil-3d-labels.html

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report