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: 

add profile programatically using .net in 2012?

17 REPLIES 17
SOLVED
Reply
Message 1 of 18
JamesMaeding
882 Views, 17 Replies

add profile programatically using .net in 2012?

I'm not finding any way to add a profile to an alignment using .net api.

Is com the only way?

 

I can get at pvis via .net, so seems off they would leave out ability to add profiles.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

17 REPLIES 17
Message 2 of 18
Jeff_M
in reply to: JamesMaeding

You can do this in .NET.

See THIS....

Jeff_M, also a frequent Swamper
EESignature
Message 3 of 18
JamesMaeding
in reply to: Jeff_M

I have to say, you have me stumped.

I looked around ofr use of civilwrapper and found Isaac Rodriguez saying its only for internal use:

http://civilizeddevelopment.typepad.com/civilized-development/2012/01/updated-civil-3d-2012-api-refe...

 

I see the VAlignment class, but is this some accidental documentation that we really should not rely upon for production apps?

any examples of its use?


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 4 of 18
Jeff_M
in reply to: JamesMaeding

Well, that link should have taken you to the correct spot. Let's try this:

http://docs.autodesk.com/CIV3D/2012/ENU/API_Reference_Guide/net/html/e60366cd-561b-cc32-923b-159763f...

Jeff_M, also a frequent Swamper
EESignature
Message 5 of 18
JamesMaeding
in reply to: Jeff_M

exactly, but see anything that lets you make a profile given a list of pvis or array of doubles for sta, elev...? You can only create via layout or surface.

Then add that profile to the profileIDs collection of the alignment? Notice the profile collection of an alignment is only exposed via a get function.

 

Maybe I am missing the obvious, but both things point towards com only.

thx


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 6 of 18
Jeff_M
in reply to: JamesMaeding

Once you create the profile you add the ProfilePVI's to the ProfilePVICollection of the Profile you just created. It took me a bit to figure out the steps needed, and that code I have at home so this just going by what I'm seeing in that help and memory. But, it does work 🙂

Jeff_M, also a frequent Swamper
EESignature
Message 7 of 18
Jeff_M
in reply to: Jeff_M

You can also add Profile Entities.

There is a VB.NET example of how to do this in the 2012 Samples folder.

Jeff_M, also a frequent Swamper
EESignature
Message 8 of 18
JamesMaeding
in reply to: Jeff_M

ok, that makes sense.

I guess I thought CreatebyLayout did something different, but the params seem to indicate it just makes the basic profile object. Good enough, thanks a bunch.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 9 of 18
JamesMaeding
in reply to: Jeff_M

nice, the stupid examples are different between vb and C#. I never ever would have though to look under VB folder if not in C# one.  its the wild west indeed.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 10 of 18
Jeff_M
in reply to: JamesMaeding

Glad I could help!

 

If you find a response which answers your question, please be sure to accept the actual post which helped you as the solution. This will help future searchers quickly find answers to their own questions. Thanks!

Jeff_M, also a frequent Swamper
EESignature
Message 11 of 18
JamesMaeding
in reply to: Jeff_M

done, good reminder.

I started another thread on when and where to use a documentlock, that is another issue i am working through.

Seems like every tool that does something will be locking the doc.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 12 of 18
Jeff_M
in reply to: JamesMaeding

I'm far from being an expert, but I've found I only need to use the Document lock when 1.) I use a modeless dialog, 2.) I use a palette, 3.) I use the CommandFlags.Session parameter. There may be other times, but I'm not recalling anything at the moment.

Jeff_M, also a frequent Swamper
EESignature
Message 13 of 18
JamesMaeding
in reply to: Jeff_M

yah, that modeless dialog one is big for me, since I have a few main dialogs that float.

Guess I just put a using doclock at the top of the button callback.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 14 of 18
JamesMaeding
in reply to: JamesMaeding

how about adding an EG profile by list of PVIs?

Do we just forget EG profiles by user?

I guess Autodesk is deciding they can only be generated by a (C3D) surface....


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 15 of 18
Jeff_M
in reply to: JamesMaeding

Well, you can't do that directly in C3D, either, so it's no surprise there's no API for it. Instead, you can mimic what one would do in C3D....create a 3dpoly from the known points, offset (I know you can't directly offset a 3dpoly, but we all have helper functions to do this, don't we?), create surface from the 3 3dpolys, create the profile from this surface, change it to Static, delete the surface and 3 3dpolys.

 

Note that I have not actually used this approach, but it's the first thing I'd test.

Jeff_M, also a frequent Swamper
EESignature
Message 16 of 18
JamesMaeding
in reply to: Jeff_M

I guess when LDT gets retired, so does its definitions of what objects are.

Who needs EG profiles anyway.....


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 17 of 18
Jeff_M
in reply to: JamesMaeding

Actually, what is an EG profile other than a type and a name? Oh, and VC's can't be added to EG types, anything else? So to create a profile by PVI, create a FG profile by the PVI's and assign it an EG style. I can't think of any reason why this wouldn't work.

Jeff_M, also a frequent Swamper
EESignature
Message 18 of 18
JamesMaeding
in reply to: Jeff_M

I recall that in LDT, you could have tons of pvis in an EG prof, while an FG would choke at about 200 or something.

I don;t expect those limitations in C3D.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

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

Post to forums  

Rail Community


Autodesk Design & Make Report