add profile programatically using .net in 2012?

add profile programatically using .net in 2012?

JamesMaeding
Advisor Advisor
1,787 Views
17 Replies
Message 1 of 18

add profile programatically using .net in 2012?

JamesMaeding
Advisor
Advisor

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

0 Likes
Accepted solutions (1)
1,788 Views
17 Replies
Replies (17)
Message 2 of 18

Jeff_M
Consultant
Consultant

You can do this in .NET.

See THIS....

Jeff_M, also a frequent Swamper
EESignature
0 Likes
Message 3 of 18

JamesMaeding
Advisor
Advisor

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

0 Likes
Message 4 of 18

Jeff_M
Consultant
Consultant

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
0 Likes
Message 5 of 18

JamesMaeding
Advisor
Advisor

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

0 Likes
Message 6 of 18

Jeff_M
Consultant
Consultant
Accepted solution

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
0 Likes
Message 7 of 18

Jeff_M
Consultant
Consultant

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
0 Likes
Message 8 of 18

JamesMaeding
Advisor
Advisor

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

0 Likes
Message 9 of 18

JamesMaeding
Advisor
Advisor

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

0 Likes
Message 10 of 18

Jeff_M
Consultant
Consultant

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
0 Likes
Message 11 of 18

JamesMaeding
Advisor
Advisor

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

0 Likes
Message 12 of 18

Jeff_M
Consultant
Consultant

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
0 Likes
Message 13 of 18

JamesMaeding
Advisor
Advisor

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

0 Likes
Message 14 of 18

JamesMaeding
Advisor
Advisor

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

0 Likes
Message 15 of 18

Jeff_M
Consultant
Consultant

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
0 Likes
Message 16 of 18

JamesMaeding
Advisor
Advisor

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

0 Likes
Message 17 of 18

Jeff_M
Consultant
Consultant

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
0 Likes
Message 18 of 18

JamesMaeding
Advisor
Advisor

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

0 Likes