Jump to content

Code for labeling swales


CyberAngel

Recommended Posts

One of our most tedious and common tasks is labeling swales. You draw a polyline, you add a few elevation markers based on the design surface, and that's about it. So it would be nice if we could write a program for that. Plus it would be nice if it's easy to maintain.

 

According to my research, though, that's a tall order. The only languages that let you drill that deep into Civil 3D have to allow .NET or COM, and that means you have to install Visual Studio. I'd rather not do that just to create and maintain one app.

 

Does anyone know of a way to access Civil 3D surfaces and create elevation labels using AutoLISP or some other interpreted language? Python, maybe? Not asking for code, just a more suitable way to write it.

Link to comment
Share on other sites

Does this thread help you any? Change surface build settings via lisp - AutoLISP, Visual LISP & DCL - AutoCAD Forums (cadtutor.net)

 

Have you looked into Dynamo? Civil 3D still uses that?

 

Getting Started with Dynamo for Civil 3D: A Beginner’s Guide | Autodesk University

 

Python should definitely work, but I do not have access to Civil 3D to check.

Link to comment
Share on other sites

17 minutes ago, SLW210 said:

Does this thread help you any? Change surface build settings via lisp - AutoLISP, Visual LISP & DCL - AutoCAD Forums (cadtutor.net)

 

Have you looked into Dynamo? Civil 3D still uses that?

 

Getting Started with Dynamo for Civil 3D: A Beginner’s Guide | Autodesk University

 

Python should definitely work, but I do not have access to Civil 3D to check.

Thank you, yes, I had already bookmarked your first link (thanks again, CAD Tutor!).

 

I've played around with Dynamo and Python but not at the same time. That might be the road to follow.

Link to comment
Share on other sites

Okay, I've spent part of the last week looking at Dynamo again. Apparently, the people who seriously use this package could fit into a monorail car. Autodesk created a package called Toolkit, which has a lot of handy, um, tools. A user created an entire GitHub package for Dynamo and Civil 3D called Camber. There is a node in Camber to create a surface elevation label, which solves half my problem.

 

What's a node, you wonder? Dynamo is visual programming, so instead of functions or methods, you have nodes. (You find nodes in Blender as well.) Here's a sample:

 

Dynamosample1.png.7b8eedd32da8e189dcd2a418751baaec.png

 

The goal is to process from left to right. The wires (tubes) transfer output from one node to input for another node. The two big nodes on the right, with all the wires running into them, are supposed to create surface elevation labels. They need a surface, a label style, and a marker style, which are picked from lists. Then you pick points and pass them both to the label nodes. There are a lot of crossed wires, but that's because I have several inputs going to multiple outputs. The top box on the right creates a 3D polyline between the two picked points and adds it to the drawing. (The Watch box just shows me the polyline when it's done--or it's supposed to. This thing doesn't quite work yet.)

 

Once you catch on, this is definitely easier than code. You can't pass one type of output into a different type of input, so it automatically does type checking. You can see the structure of your algorithm. You don't have to worry about importing libraries. The downsides are that you have to change the way you think about getting things done, and sometimes you have to spend more time setting things up than solving the actual problem.

Link to comment
Share on other sites

I am not sure but have a sneaky feeling can add a point to a surface using the correct civ3d command via lisp. You can find the command in the CUI. Over the years there is sample code supplied with CIV3D I am not sure if add a point is there, definitely use lisp to make a surface is there. Look in Something like this there is a VL api.

 

Lastly if you search down the CIVIL 3D 2014 directory you will find a example of how to create a TIN via a program, I will see if I can find it, something like Civil 3D API. I may have seen last in CIV3d2012.

 
Search for c:\Autodesk\Autocad Civil3d 2014\sample\civil 3d api\com\vba\SurfaceoperationSample.dvb

 PS have Point label style changer.lsp for second step.

 

Doing some more digging

Check post by Hippe13 I think is answer. 

 

 

I have a dcl select surface even if not displayed. 

 

You may also be interested in this for CIV3D surface display uses a toolbar approach the way it should work

.Chcontourstoolbar.zip

Edited by BIGAL
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...