This is Augusto Goncalves's Typepad Profile.
Join Typepad and start following Augusto Goncalves's activity
Augusto Goncalves
Sao Paulo, Brazil
Recent Activity
This sample code should track events on the .NET environment, that's probaly why you are getting those errors (due the LISP events)
Removing all custom handlers of an event
By Augusto Goncalves In some scenarios, we may add more than one handler for a specific event. In this case, AutoCAD will throw it several times. Imagine a code like the one below, where for the Document object we add 2 handlers duplicated, and another different. <CommandMethod("addEvents")> _ ...
Dan, with VBA every operation will trigger a regen, it's just how the COM API (ActiveX) works.
Force AutoCAD to update the graphics display area
By Augusto Goncalves You can force the graphics update inserting the following lines in the code: actrTransactionManager->flushGraphics(); acedUpdateDisplay(); In the case where you use transactions to open entities and you have transaction(s) started, you then need to also call: actrTransact...
Ben,
I believe the other way would be to PASTE SPECIAL, which creates an OLE object. I'm afraid this is not exposed as an API, you may be able to use P/Invoke as shown here http://adndevblog.typepad.com/autocad/2012/04/update-linked-ole-object-from-net.html
Regards,
Augusto Goncalves
How to insert a RasterImage using the .NET API?
By Augusto Goncalves To insert a RasterImage we also need to create a image definition for it, as the image we can see at the drawing is just a reference to this definition. This sample code demonstrate how open an existing definition (e.g. MY_IMAGE_NAME), if exists, or create if it doesn’t, and...
HI Dale, you're right! Thanks for the input.
Delete custom FamilyParameter
By Augusto Goncalves (@augustomaia) Here is a quick code showing how to delete a family parameter using API. It’s not on the “obvious” way, but it’s possible. UIApplication uiapp = commandData.Application; UIDocument uidoc = uiapp.ActiveUIDocument; Application app = uiapp.Application; Document d...
Sebastian,
Unfortunately the Pipe Pressure network is not exposed as COM objects, therefore this will not work.
Regards,
Augusto Goncalves
Pipe/Structure stations & elevation at ProfileView
By Augusto Goncalves There is an interesting object available on the Civil 3D API: the ProfileViewPart. Actually it’s a database resident object, meaning we can select and get its ObjectId, but also acts as a ‘proxy’ for Part (Pipe and Structure) that are on a specific ProfileView. More than tha...
Let me check if a colleague can help you, currently I'm not working with Revit API. Sorry I missed this :-)
Delete custom FamilyParameter
By Augusto Goncalves (@augustomaia) Here is a quick code showing how to delete a family parameter using API. It’s not on the “obvious” way, but it’s possible. UIApplication uiapp = commandData.Application; UIDocument uidoc = uiapp.ActiveUIDocument; Application app = uiapp.Application; Document d...
Please see updated function at https://forge.autodesk.com/blog/enumerating-leaf-nodes-viewer
RGraph chart library and View & Data API
By Augusto Goncalves (@augustomaia) It's quite straightforward to write an extension to View & Data, just write a custom code for load and for unload. You'll find several extensions on this blog, including this: Integrating a chart library, by Philippe Leefsma. This post uses Philippe's sample a...
It not using the Forge .NET SDK and needs improvements on the security part.
C# desktop with Data Management API
By Augusto Goncalves (@augustomaia) This is a follow up from this previous post, which demonstrates a basic approach for desktop app with 3-legged OAuth. One of the biggest challenge is to ensure your client ID & secret are protected. For that, this sample has 3 projects: Forge: a class librar...
Hi Pierre,
.NET the way to go with Civil 3D. Lisp may fail on some Civil 3D ActiveX API calls, it's not supported....
-Augusto Goncalves
Alignment Sample Line Intersection
By Augusto Goncalves This question came from Grace Ferrari: from a given alignment (e.g. Alignment 01) with sample lines, how can I find the intersection of each sample line on another alignment (e.g. Alignment 02). The image below show the scenario, thanks Grace for sharing the image. To imp...
Ben, try the link again.
C# desktop with Data Management API
By Augusto Goncalves (@augustomaia) This is a follow up from this previous post, which demonstrates a basic approach for desktop app with 3-legged OAuth. One of the biggest challenge is to ensure your client ID & secret are protected. For that, this sample has 3 projects: Forge: a class librar...
Daniel,
Before Brian jump in, for more complex questions, the API Forum is the best route: https://forums.autodesk.com/t5/inventor-customization/bd-p/120
Regards,
Augusto Goncalves
UnitsOfMeasure object and example
By Augusto Goncalves UnitsOfMeasure is an object that helps conversion of values from and to Inventor’s database units. Inventor internally always uses cm (centimeters) for length, radians for angle, kg (kilograms) for mass and seconds for time. But the user can choose to work in another units, ...
Rosario, I would suggest you to post as a question on http://forums.autodesk.com/t5/autocad-civil-3d-customization/bd-p/190
Regards,
Augusto Goncalves
Is a Civil 3D instance?
By Augusto Goncalves This is a .NET version of the code posted by a colleague, see original here, redesigned to Civil 3D naming. When we get a running instance of AutoCAD, we don’t know which vertical is actually running as all of them are basically the same root object. To determine which versi...
If the .addin and the .dll are at the same folder, you don't need the [TARGETDIR] piece, just leave the .dll name.
Revit 2015 Add-In Manager
By Augusto Goncalves There is a small change on the Revit 2015 SDK regarding the Add-In Manager: it now comes with just the .dll and .addin files, we removed the MSI installer. Important: make sure you download the latest release of the SDK from the Developer Center (later than May 14, 2014). He...
I had a similar problem on the RPi when the mic (USB) was not properly configured, can you double check that?
Raspberry Pi 3 + NodeJS + Electron
By Augusto Goncalves (@augustomaia) A couple weeks ago I did a testing project with voice recognition and voice feedback for AutoCAD View & Data. After that I started asking myself: can we expand this to create a personal assistant? The idea was to leave it on the house, for instance, and then i...
That's a good point: indeed you should call .Dispose() if the Entity is not appended to the database. Thanks for pointing that out.
Get CogoPoint label text
By Augusto Goncalves The CogoPoint object on Civil 3D can hold labels with more information than the regular Description, which contains only part of the information (and sometimes not the same showed on the point). One alternative could be the CogoPoint.GetLabelTextComponentOverride method, p...
Vitaliy,
The solution/sample is almost done, should be live soon.
Regards,
Augusto
3-legged OAuth on desktop apps (C# & WinForm)
By Augusto Goncalves (@augustomaia) If you don't know OAuth or the differences between 2-legged or 3-legged authentication on Forge, please review this webinar. It's quite straightforward to implement OAuth on a web app: as everything is on the browser, including the redirect callback, it's almo...
Tyle.
The code should go the Application Startup level, otherwise will not remain active. That's the first piece of the code.
What's your overall goal here? This is indeed an old approach...
Regards,
Augusto Goncalves
Capture Escape key on Revit
By Augusto Goncalves In some cases we need to hook to Revit to track some keys, for instance the ESCAPE key. This can be done with Win32 APIs with SetWindowsHookEx method. Below is the regular OnStartup and OnShutdown with calls to it. public Result OnStartup(UIControlledApplication application...
Thanks for sharing.
Monitoring object during UNDO/REDO with .NET API
By Augusto Goncalves When an object is added, modified or deleted from the drawing, a common scenario consist in write that information to an XML file by using the ObjectAdded and ObjectErased events of the database reactor. But when UNDO and REDO commands are used in between, these events did n...
Hi,
I don't believe you can change this ID, it's read-only and not a parameter while creating the align entity. That's where this approach comes in: remove and replace ensuring the previous and next remains.
Regards,
Augusto Goncalves
Replacing Alignment Entities
By Augusto Goncalves During one of my API trainings, a question came up: is it possible replace an alignment entity, let’s say an Arc, with a Spiral-Curve-Spiral? This can be interesting if we want to ‘validate’ the alignment against some localized standards. The alignment object of Civil 3D .N...
Thanks for your comment Damir, I haven't tested this scenario... will need to double check it. Do you have an alternative suggestion?
Best,
Augusto Goncalves
Pipe Network parts on Profile View
By Augusto Goncalves On a profile view, after add a pipe network part (structure or pipe), Civil 3D creates a new entity: ProfileViewPart. This object don’t have many methods, but it’s a database resident object (with ID and geometry). So the question is: how get the part station and elevation o...
You're right, we just prefer to avoid error checking to keep code clean/small for blog posts, but glad you pointed out.
Cheers,
Augusto Goncalves
Replacing Alignment Entities
By Augusto Goncalves During one of my API trainings, a question came up: is it possible replace an alignment entity, let’s say an Arc, with a Spiral-Curve-Spiral? This can be interesting if we want to ‘validate’ the alignment against some localized standards. The alignment object of Civil 3D .N...
Nicklas,
A call to RevitLinkType.Reload should do it..
From the help file: Loads or reloads the Revit link from its currently-stored location. If the link is an external resource, Revit will contact the IExternalResourceServer to get the latest version of the link.
Regards,
Augusto Goncalves
Inserting a Revit Link file
By Augusto Goncalves Starting on release 2013 it is possible create a RevitLinkType, which defines the link to a .rvt file, and then insert a new RevitLinkInstance on the project. // Ask for the file name System.Windows.Forms.OpenFileDialog openFileDlg = new OpenFileDialog(); if (openFileDlg...
StationOffsetLabel.Create quick sample code
By Augusto Goncalves (@augustomaia) This is a quick sample code on how call StationOffsetLabel.Create method for all Alignments on each Station increment interval. Note it's using the first StationOffsetLabelStyle and first MarkerStyle from the respective style collections. [CommandMethod("addStationOffsetLabel")] public static void CmdAddStationOffsetLabel() { CivilDocument civilDoc = CivilApplication.ActiveDocument; Database db =... Continue reading
Posted May 5, 2016 at Infrastructure Modeling DevBlog
Comment
0
Rodrigo, this sample is in C++ (so it doesn't uses packages), but you need to compile it using the COM references. It also should not require you to start AutoCAD (as it uses only the COM API for Dwg Props). Finally the VS Community doesn't include MFC (I believe) that is required for CString (among other Windows features).
Access drawing properties outside AutoCAD
By Augusto Goncalves We can use either MFC or ATL to create a client VC++ application of the COM server to access that information. In the attached sample, MFC is used. We should add a class Iproperties which wraps the methods and properties of the COM server from DwgPropsX.DLL with MFC class wi...
Set elevation for FeatureLine Points
By Augusto Goncalves (@augustomaia) Since Civil 3D 2016 SP1 we have the Feature Line API available for developers. It's possible to set new elevation for points on the feature line, but it may not be that direct to do so as we need the index of the point and, if... Continue reading
Posted Apr 14, 2016 at Infrastructure Modeling DevBlog
Comment
0
More...
Subscribe to Augusto Goncalves’s Recent Activity