AutoCAD Civil 3D Customization

Reply
*Expert Elite*
Civil3DReminders.com
Posts: 2,437
Registered: ‎10-13-2005
Message 1 of 7 (241 Views)

Profile View Band Update

241 Views, 6 Replies
08-23-2012 03:23 PM

When I edit a profile by adding a PVI, the profile view bands update poorly. The band down station is removed and the new PVI band label isn't added. Is there a way to force Civil 3D to refresh the bands programattically? Going into the profile view properties refreshes the band to show correctly, but I don't think that's an acceptable solution. 

 

Christopher

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
ADN Support Specialist
Partha.Sarkar
Posts: 543
Registered: ‎06-09-2009
Message 2 of 7 (200 Views)

Re: Profile View Band Update

09-04-2012 01:22 AM in reply to: Civil3DReminders.com

Hi Chris,

 

I don’t see ProfileView has any API to Refresh or ForcreRefresh.
Did you try to use send command “regen” via API ? Does that help ?

 

Thanks,



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

*Expert Elite*
Civil3DReminders.com
Posts: 2,437
Registered: ‎10-13-2005
Message 3 of 7 (191 Views)

Re: Profile View Band Update

09-04-2012 09:53 PM in reply to: Partha.Sarkar

Yes, I tried regen, but that didn't work. 

 

Christopher

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
ADN Support Specialist
Partha.Sarkar
Posts: 543
Registered: ‎06-09-2009
Message 4 of 7 (184 Views)

Re: Profile View Band Update

09-05-2012 09:52 PM in reply to: Civil3DReminders.com

Hi Chris,

 

Could you send me the code snippet and related DWG file to investigate this issue ? You can drop me an email with these files, I will look into it.

 

Thanks,

 



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

*Expert Elite*
Civil3DReminders.com
Posts: 2,437
Registered: ‎10-13-2005
Message 5 of 7 (179 Views)

Re: Profile View Band Update

09-06-2012 07:34 AM in reply to: Partha.Sarkar

 

Partha,

 

Below is an extraction of the code that I am using. There are also some transient graphics that get drawn, but the code is below. The Regen and UpdateScreen was primarily used to get rid of any lingering temporary objects. Replace the station and elevation to a value that works with the profile you test this on.

 

private void RunCommand()
{
Database db = acadApp.Application.DocumentManager.MdiActiveDocument.Database;
Editor ed = acadApp.Application.DocumentManager.MdiActiveDocument.Editor;
using (Transaction tr = db.TransactionManager.StartTransaction())
{

 

ObjectId profileObjId = civDoc.SelectProfile("Select profile section to edit: ", out profView);

 

Profile profSection = profileObjId.GetObject(OpenMode.ForRead) as Profile;

profSection.PVIs.AddPVI(editPtForm.PointStation, editPtForm.PointElevation);

 

 

ed.Regen();
ed.UpdateScreen();

tr.Commit();

}

}

 

public static ObjectId SelectProfile(this CivilDocument civDoc, string prompt, out ProfileView profView)
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
PromptEntityOptions pops = new PromptEntityOptions("\n" + prompt);
profView = null;
PromptEntityResult profileRes = ed.GetEntity("AeccDbVAlignment", pops, "\nYou must select a Profile:");
if (profileRes.Status == PromptStatus.OK)
{
// Get the profile view of the profile.
Profile prof = profileRes.ObjectId.GetObject(OpenMode.ForRead) as Profile;
Alignment align = prof.AlignmentId.GetObject(OpenMode.ForRead) as Alignment;
profView = align.GetProfileViewByPoint(profileRes.PickedPoint).GetObject(OpenMode.ForRead) as ProfileView;

return profileRes.ObjectId;
}
return ObjectId.Null;
}

 

Thanks

 

Christopher

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
ADN Support Specialist
Partha.Sarkar
Posts: 543
Registered: ‎06-09-2009
Message 6 of 7 (167 Views)

Re: Profile View Band Update

09-14-2012 01:59 AM in reply to: Civil3DReminders.com

Hi Chris,

 

I am not able to compile your code using Civil 3D 2013 assemblies. Which release of Civil 3D are you using ?

civDoc.SelectProfile("Select profile section to edit: ", out profView);

what is this civDoc ? COM ? or .NET ?

 

Some other unresolved variables - editPtForm

rofView = align.GetProfileViewByPoint(profileRes.PickedPoint).GetObject(OpenMode.ForRead) as ProfileView;

 

Your input required here to resolve the above issues.

 

Thanks,



Partha Sarkar
Developer Technical Services
Autodesk Developer Network

*Expert Elite*
Civil3DReminders.com
Posts: 2,437
Registered: ‎10-13-2005
Message 7 of 7 (158 Views)

Re: Profile View Band Update

09-15-2012 01:55 AM in reply to: Civil3DReminders.com

Here's the a complete code example that should work without modification. The previous code utilized some extensions on the CivilDocument to make cleaner code. 

http://blog.civil3dreminders.com/2012/09/adding-profile-pvi-through-api.html

 

Christopher

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Civil 3D Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for AutoCAD Civil 3D helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Civil 3D

Twitter

Facebook

Blogs