PDA

View Full Version : Making a Custom Object Type



irneb
2012-12-11, 07:18 AM
Anyone know of a way to do this?

I'm after an object type which the user can edit by placing linework inside it. It's supposed to be used as a directional constraint for a renumbering system - i.e. the user would draw the lines in the direction(s) that the numbers should increment, thus enabling a much quicker / automatic renumbering than any others I've found thus far.

BlackBox
2012-12-11, 02:56 PM
As I am not that familiar with Revit, perhaps this will help, even if only in concept:

Stephen Preston describes in this post (http://forums.autodesk.com/t5/Visual-Basic-Customization/Custom-Objects-Access-Type-amp-Properties-From-NET/m-p/3449883#M96220), that you can create custom object types provided there's an applicable wrapper for it, and it can inherit a base types properties, methods, events, etc..

As for how to do this, I've not yet attempted to do so myself, but I did stumble upon this article (http://adndevblog.typepad.com/autocad/2012/04/adn-devlab-autodesk-hq-san-rafael-ca.html) from AdnDevBlog, while attempting to learn more about interacting with the Database.ObjectModified Event, and learned about the "No, No" of using StartTransaction() in lieu of StartOpenCloseTransaction()... In any event, Fenton mentions (briefly) that they helped a developer to build a custom object enabler which may also be something you'll need if this is to be used by more than yourself.

.Net custom object wrappers (http://forums.autodesk.com/t5/Autodesk-ObjectARX/Net-custom-object-wrappers/td-p/3623992#.UMdI6XfhRNo)

HTH

BlackBox
2012-12-11, 03:02 PM
Again, not sure of the .NET API Object Model overlap between AutoCAD and Revit (or the lack thereof), but I also found this old thread (http://72.77.202.9/index.php?topic=19989.0) over at TS, which includes the C++.

irneb
2012-12-12, 05:41 AM
Thanks RM, though what I'm after is trying to add a 2D Sketch (http://wikihelp.autodesk.com/Revit/enu/2012/Help/API_Dev_Guide/0000-API_Deve0/0074-Revit_Ge74/0114-Sketchin114/0115-The_2D_S115) to some view specific custom object. Something like a Detail Curve (http://wikihelp.autodesk.com/Revit/enu/2012/Help/API_Dev_Guide/0000-API_Deve0/0074-Revit_Ge74/0102-Annotati102/0104-Detail_C104), though I don't want it plottable (i.e. either have all its lines forced to invisible, or have it act like reference planes - which doesn't plot by default).

The idea is to have an object which defines the direction of numbering per view, per object type. Thus you'd place one of these for rooms, another for doors, another for windows, another for parking bays, etc.

An alternative idea would be to store the "sketch" as Extensible Data (http://wikihelp.autodesk.com/Revit/enu/2012/Help/API_Dev_Guide/0135-Advanced135/0136-Storing_136/0141-Extensib141) to the View Object itself. But that means I've got to re-implement all sorts of stuff about how to store an arc, a spline, a normal line, etc. Not to mention, I still need to get a 2d Sketch from the user, and I'd like the capability for the user to copy-paste these to other views easily.