.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Create instance of my object
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I have created a class that inherits Polyline. I have added properties to that class.
When I try to SetDatabaseDefaults with my object, I get an error "Set database defaults is not a member..."
But if I create a new Polyline, SetDatabaseDefaults works for that object.
Shouldn't the SetDatabaseDefaults method become a member of my class when I inherit from Polyline?
Thanks,
Tim
Delta Engineering Systems
Redding, CA
Autodesk Authorized Value-Added Reseller
Re: Create instance of my object
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Re: Create instance of my object
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Yes, this is a .Net class.
Delta Engineering Systems
Redding, CA
Autodesk Authorized Value-Added Reseller
Re: Create instance of my object
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I figured it out.
I had originally inherited from Autodesk.AutoCAD.GraphicsInterface.Polyline, but if I inherit from Autodesk.AutoCAD.DatabaseServices.Polyline instead, the object will setdatabasedefaults.
I don't know why one polyline would have different properties than another, but I'm not gonna let myself get hung up on that detail right now!
So, advice for other newbies, there might be multiple Autodesk-supplied classes in various Autodesk libraries. Those classes might use the same name but not have the same properties and methods.
Thanks, Alexander, for responding. I'm sure you'll be seeing more beginner-level posts from me....
Delta Engineering Systems
Redding, CA
Autodesk Authorized Value-Added Reseller
Re: Create instance of my object
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
As I understand you try to create custom entity with help of .NET API. Am I right? It is impossible to create custom entity with help of .NET API. It is possible only with help of ObjectARX (C++). Therefore no sense to create classes inherited from DBObject / Entity, as an instance of this class will not be able to create and add to the dwg-file.
Re: Create instance of my object
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Wow. Thanks, Alexander. You just saved me a bunch of hours.
The reason I was going to create my own class was so I could apply properties to a polyline-like object, like you would with Xdata through Visual LISP. Is there a way to apply custom properties to an AutoCAD object using VB.NET, without creating my own class?
Or should I just switch to C++?
Delta Engineering Systems
Redding, CA
Autodesk Authorized Value-Added Reseller
Re: Create instance of my object
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
tcorey wrote:
Is there a way to apply custom properties to an AutoCAD object using VB.NET, without creating my own class?
What do you mean by Custom Property? What do you mean by Custom Property? The property which appears in the Properties pane (OPM)?
Try code of Kean Walmsley: http://through-the-interface.typepad.com/through_t
tcorey wrote:
Or should I just switch to C++?
Only if you ready to create own custom entity. This is not the easy way. Good luck!
Re: Create instance of my object
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
By Custom Properties, I mean my own properties and values assigned to a polyline object. In particular, I want to create a property that holds the View to which my polyline is associated. Using Visual LISP, I would create Xdata to do this.
I read through Kean's post and it appears that there is a way to do this with vb.net, so I might continue down that road for now. Or not. Maybe I'll switch to c++, although it's been even longer since I used it than it has been for VB.
Decisions, decisions....
Delta Engineering Systems
Redding, CA
Autodesk Authorized Value-Added Reseller
Re: Create instance of my object
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
>> Using Visual LISP, I would create Xdata to do this.
Using .NET, you also can create Xdata or ExtensionDictionary/Xrecord,this would certainly be simpler than the objectARX/C++ route...
Re: Create instance of my object
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks!
Delta Engineering Systems
Redding, CA
Autodesk Authorized Value-Added Reseller



