Ad

Monday, December 07, 2009

Civil 3D 2010 Swap Parts Part III

This post will show how to add the capability to swap parts in a profile view to the Swap Parts command in the Civil 3D Reminders Pack, see the previous post here. The code addition is pretty small. All that is needed is to check to see if the selected entity is a ProfileViewPart and if it is convert the entity to the corresponding pipe or structure entity. The code then runs like it did before.

            ' Add code to support profile view parts
If TypeOf ent Is Autodesk.Civil.PipeNetwork.DatabaseServices.ProfileViewPart Then
' Convert the profile view part to it's corresponding pipe or structure part.
Dim oProfileViewPart As Autodesk.Civil.PipeNetwork.DatabaseServices.ProfileViewPart
oProfileViewPart = ent
ent = DirectCast(tr.GetObject(oProfileViewPart.ModelPartId, OpenMode.ForWrite), Entity)
End If



Add the code right before it checks to see if the ent is a Pipe.

5 comments:

stortzj said...

I've attempted to run the RemindersPack in C3D 2011 but it throws errors? I'm guessing it's coded to reference 2010 specifically?
"************** Exception Text **************
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'C3DRemindersPack.SwapParts' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Autodesk.AECC.Interop.UiLand, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b74b3593c4d6567f' or one of its dependencies. The system cannot find the file specified.
File name: 'Autodesk.AECC.Interop.UiLand, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b74b3593c4d6567f'
at C3DRemindersPack.SwapParts..cctor()"

Christopher Fugitt said...

Yes, it needs to be updated for Civil 3D 2011. I'll do that tonight.

Christopher Fugitt said...

Clicking the banner at the top will direct you to a 2011 version of the Civil 3D Reminders Pack.

Tony said...

Have you created a swap multiple part vba for 2012?

Tarek Farah said...

Hi Christopher, can you do this for autocad civil 3d 2012 ?

LinkWithin

Blog Widget by LinkWithin

Ad