Showing posts with label VBA. Show all posts
Showing posts with label VBA. Show all posts

Wednesday, 15 December 2010

How can you go 3D when you still get 2D

How many times have you wanted to use Civil3d and all its tools only to be served up some dxf or dwg thats 2D typically out of SDR Map, CivilCad or 12D with nothing but mtext heights and crosses. No blocks with attributes to extract the height data nothing.  Track down the original surveyor if still in business? Yeah right. Enter the points manually? No thanks.
Well maybe here is some code to help you get 80% of the way there in no time at all. Some of you may of seen it before as I originally posted it on the Autodesk Civil Community site a few years ago which has since been taken down. The code was pulled together from a couple of the VBA examples that shipped with Autocad and does not work with any Civil3d objects but could be extended to do the Civil3d point creation automatically.
Basically all you have do is :-
  1. Download the code https://sites.google.com/site/c3dxtreme/home/convert_text_to_point.zip?attredirects=0&d=1
  2. Figure out the typical x and y offset for the majority objects from the insertion point of the mtext containing the spot height text to the insertion point of the object marking the actual position of the spot height.
  3. Run the code.
  4. Enter the x and y offset.
  5. Enter the text used to represent the decimal character.
  6. Select the mtexts representing the heights and press enter.
  7. Bang Basic Autocad points at the correct height are entered at all the spot height insertion points.
  8. Use Civil3d built in tools to create Civil3d points, add them to your surface and we are in 3d and cooking with gas.
A couple of issues to note are if the survey is of reasonable complexity there will be a small percentage of points where the x and y offset has been changed most likely to stop text overlapping so manually drag the odd few points to the correct position once created with osnapz set to 1 so the z does not change. If a point can not be created as the text is something different the object colour is changed and you will have figure it out and enter it manually. Here is a demo video. 
Unable to display content. Adobe Flash is required.

Wednesday, 8 December 2010

Automatically Label those Road Assemblies quickly

I am a great believer in the 80/20 rule and Civil3d seems to follow this to a tee. For example 80% of civil3d objects have a labelling style and 20% of them do not. One example of those objects that do not are assemblies and sub assemblies. Anyone that works with Civil3d on a daily basis will know the hassle when  you take over someone’s corridor model and have to figure out what assemblies are what. Tony on his blog tonyscivil3dworld gave a great tip at the beginning of the year of how to label assemblies with mtexts with fields.
http://tonyscivil3dworld.blogspot.com/2010/01/assemblies-names-labels.html

As I am what one could call a lazy drafter and do not like to sit there doing time consuming labelling. I searched the web for now one could add the labels to assemblies automatically and sure enough on Kean Walmsley’s blog http://through-the-interface.typepad.com he gives and example on now to add labels with .net http://through-the-interface.typepad.com/through_the_interface/fields/ so I have combined the two tips together in the following vba code for 2010 to do the labelling automatically. Here is a link to download the vba code
https://sites.google.com/site/c3dxtreme/home
and here is quick video demonstrating of what the code does
Unable to display content. Adobe Flash is required.
and here is a link on how to embed a video with jing http://www.techsmith.com/learn/jing/tutorials/share/embed-jing-content/ for those that are interested.
Related Posts Plugin for WordPress, Blogger...