Jump to content

Recommended Posts

Posted

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.

Posted
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.

Posted

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.

Posted (edited)

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
  • 5 months later...
Posted
On 4/24/2024 at 7:59 PM, BIGAL said:

I am not sure but have a sneaky feeling can add a point to a surface using the correct civ3d command via lisp.

 

I've managed to write some code that can draw a 3D polyline on a selected surface. That's half the battle.

 

The other half is a command that can draw spot elevation labels at both ends of my polyline. I have the parameters, all I need is a way to create the label. When you do it manually, you get a command called AECCAddSurfaceSpotElevLabel. The first thing it does is ask for a surface, which I've already used to get the elevations for the polyline. Here's the code for that:

 

      (setq pt_elev (vlax-invoke curr_enty 'findelevationatxy (car pt_start) (cadr pt_start))

 

curr_enty is a VLA object representing the surface. pt_start is the beginning coordinate of the polyline, provided by the user. What's giving me fits is finding a way to convert the surface object to a form the label creator will accept. There's also a string containing the surface name, but that doesn't work ("expects a single object"). Other things that didn't work:

(vlax-ename->vla-object curr_enty): bad argument type: lentityp

(curr_enty): bad argument value: AutoCAD command

(vlax-vla-object-> ename curr_enty): opens select surface dialogue

(vlax-get-property curr_enty name): expects a single object

(vla-get-objectid curr_enty): selected entity must be of type Surface

(vlax-vla-object->ename (vla-getobjectid curr_enty): bad argument type: VLA-OBJECT

 

I intend to post the code once it's working, but there's this major hurdle to get over. Any suggestions are welcome.

Posted

If its creating a cogo point then you should be able to add those points to a points group, then you can label that group. Again add points to CIV3D is in the sample code provided with CIV3D its buried a little deep in the directory under "sample", I have to look on a CIV3d pc again. Early versions had more examples and were lisp based.

 

Attached has lots of stuff in it about CIV3D surfaces and may be of help. It has a Toolbar for turning on/off setting style of surfaces much easier than the Toolspace. Have other stuff also.

image.png.9d7179931f9c376cc2fd6f54f9e8f4ce.png

Chcontourstoolbar.zip

 

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...