Running built-in property commands on Civil 3D

By Augusto Goncalves

In some cases we just want to invocate Civil 3D property dialogs for specific entities, let’s say an Alignment. But most commands are not customizable via APIs. Here the alternative idea is set the selection and then call the command. The following code uses AutoCAD Editor.Command API, available on 2015+

private static void ShowAlignProp(ObjectId id){  // test type as this command will not work for other types  if (id.ObjectClass != RXClass.GetClass(typeof(Alignment))) return;   Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;  ed.SetImpliedSelection(new ObjectId[] { id }); // set selection  ed.Command(new string[] { "_AeccEditAlignmentProperties" }); // run command  ed.SetImpliedSelection(new ObjectId[0]); // clear selection}

Comments

2 responses to “Running built-in property commands on Civil 3D”

  1. Hi, Augusto
    would you please help me to solve the following issue?
    I am developing a plug-in for AutoCAD Civil 3D 2015 on .NET C#. https://www.youtube.com/watch?v=Xmcz4kZDTx4&feature=youtu.be
    This plugin is used for export 3d objects to Google earth. With help of Brep i get all information about 3d objects and write it to Collada. During the export plug-in works without errors, even with a lot of 3d objects. I dispose unused objects and use the “using” statement. But after exiting Civil 3d, occurs an error.
    http://dl2.joxi.net/drive/0006/2797/457453/150109/a1c3898e0a.jpg
    Problem signature:
    Problem Event Name: APPCRASH
    Application Name: acad.exe
    Application Version: 26.0.51.0
    Application Timestamp: 52f4adcc
    Fault Module Name: accore.dll
    Fault Module Version: 20.0.51.0
    Fault Module Timestamp: 52f4ae8b
    Exception Code: c0000005
    Exception Offset: 00000000006d9cef
    OS Version: 6.1.7601.2.1.0.256.48
    Locale ID: 1033
    Additional Information 1: 59bc
    Additional Information 2: 59bc2f24ac83312559015d6dcf3c387a
    Additional Information 3: 2949
    Additional Information 4: 2949d7b14d7a156deca638281aa20dfa
    As i have understood it is Access Violation Exception, that throws when we try to access the objects that are disposed..
    This error occurs just after working with a large objects or with a lot of objects (not when closing a drawing, but when exiting the Civil)
    Here is some dumpdata… http://dl1.joxi.net/drive/0006/2797/457453/150109/90a47db9d6.jpg
    How can I fix this problem, has you any ideas?
    Any help would be appreciated!

  2. Hi Valeria,
    This is a tricky problem. As you mentioned, it’s probably related to reading data from a invalid object…
    Please do the following: run your code again and, when the problem happens, submit the error report with your email, I’ll track from here.
    Also, as this question is not related to this blog post, please log at our forum, we’ll have a better tool to talk there: http://forums.autodesk.com/t5/autocad-civil-3d-customization/bd-p/190
    Thanks!
    Regards,
    Augusto Goncalves

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading