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
tcorey wrote:
I have created a class that inherits Polyline...
Is it a .NET class?
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Yes, this is a .Net class.
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....
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.
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
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++?
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_the_interface/2009/05/modifying-an-autocad-objects-...
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!
Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"
Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
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....
Thanks!
Can't find what you're looking for? Ask the community or share your knowledge.