AutoCAD Civil 3D Customization

AutoCAD Civil 3D Customization

Reply
Contributor
theEntity
Posts: 21
Registered: ‎08-05-2012
Message 1 of 4 (236 Views)
Accepted Solution

ProfileVIew objects in drawing

236 Views, 3 Replies
07-17-2013 03:43 PM

Hello, 

Can anyone please tell me if it is possible to get all the Profile View objectIDs that is currently in the drawings?

-WITHOUT prompting a user for selection.  I want a objectIDcollection for all the profileviews.

 

I think this lacking in the api but any help would be appreciated.

 

And here is a C# code snippet using GetProfileViewIds() -

 

// Get the Aligments

ObjectIdCollection

alignments = civilDoc.GetAlignmentIds();

 

foreach

(ObjectId alignmentId in alignments)

{

 

Alignment alignment = alignmentId.GetObject(OpenMode.ForRead) asAlignment;

 

ObjectIdCollection profileViewIdColl = alignment.GetProfileViewIds();

 

// do what you want here

 

}

 

Hope this hekps !

 

Cheers,

Partha

*Expert Elite*
Jeff_M
Posts: 4,472
Registered: ‎07-22-2003
Message 2 of 4 (231 Views)

Re: ProfileVIew objects in drawing

07-17-2013 03:55 PM in reply to: theEntity

A couple of way s I can think of off the top of my head.

1. Use a filtered selection set and  Autodesk.AutoCAD.EditorInput.Editor.SelectAll(Autodesk.AutoCAD.EditorInput.SelectionFilter)

 

2. Run through all of the alignments in the drawing and get the ProfileViewIds from them with Autodesk.Civil.DatabaseServices.Alignment.GetProfileViewIds()

 

 

Jeff_M, also a frequent Swamper
ADN Support Specialist
Partha.Sarkar
Posts: 543
Registered: ‎06-09-2009
Message 3 of 4 (210 Views)

Re: ProfileVIew objects in drawing

07-18-2013 06:13 AM in reply to: theEntity

And here is a C# code snippet using GetProfileViewIds() -

 

// Get the Aligments

ObjectIdCollection

alignments = civilDoc.GetAlignmentIds();

 

foreach

(ObjectId alignmentId in alignments)

{

 

Alignment alignment = alignmentId.GetObject(OpenMode.ForRead) asAlignment;

 

ObjectIdCollection profileViewIdColl = alignment.GetProfileViewIds();

 

// do what you want here

 

}

 

Hope this hekps !

 

Cheers,

Partha



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

Contributor
theEntity
Posts: 21
Registered: ‎08-05-2012
Message 4 of 4 (203 Views)

Re: ProfileVIew objects in drawing

07-18-2013 08:08 AM in reply to: theEntity

that is perfect. 

 

I was thinking I have to iterate through ALL the objects to check if

typeof (obj) is  Autodesk.Civil.DatabaseServices.ProfileView and it would take too long.

 

Thanks so much for the help.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!