ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

data extraction wizzard custom entity

4 REPLIES 4
Reply
Message 1 of 5
jprous
1128 Views, 4 Replies

data extraction wizzard custom entity

Dear Developers

I have written a custom entity and exposed its properties via a com wrapper. I now want to link those properties to a Acad data table. I read up on the data extraction wizard, but when I select my object it doesn’t show any of my properties. I suspect I need to implement a managed wrapper as well. However, I tried to do the data extraction wizard on the SimpleSquare example (that does contain a com wrapper) but it still doesn’t show up in the data extraction wizard. Any advice?
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: jprous

Yes, you need a managed wrapper 😉

Data Extraction by default, discards properties whose Category is "Misc" (the default category), so to make your managed wrapper's properties show up in Dx, you need to set the category to something other than that, and you should also add the UnitType attribute for double type properties.

In AsdkSimpleSquare.h, add the Category and UnitType attributes to the properties of the SimpleSquare's managed wrapper, like so:

[code]
//========= begin excerpt from AsdkSimpleSquare.h ============

// Declaration of the properties (get and set)
// for what we want to expose to the managed world.

[System::ComponentModel::CategoryAttribute("Geometry")] // pointless, see below

__property Point3d get_Center();
__property void set_Center(Point3d point);

[System::ComponentModel::CategoryAttribute("Geometry")]
[Autodesk::AutoCAD::DatabaseServices::UnitTypeAttribute(UnitType::Angle)]

__property double get_Rotation();
__property void set_Rotation(double rotation);

[System::ComponentModel::CategoryAttribute("Geometry")]
[Autodesk::AutoCAD::DatabaseServices::UnitTypeAttribute(UnitType::Distance)]

__property double get_SideLength();
__property void set_SideLength(double sidelength);

__property void set_Normal(Vector3d normal);
__property Vector3d get_Normal();

//========= end excerpt from AsdkSimpleSquare.h ============
[/code]

Rebuild the project, and you will see the Rotation and SideLength properties show up in Data Extraction.

Unfortunately, Data Extraction isn't very intelligent when it comes to properties that are 3d points (e.g., Point3d), and doesn't convert them to individual properties (one for each component) automatically.

So, insofar as coordinate types go, if you need to expose them to Dx, you can remedy that in one of two ways:

1. Explicitly expose seperate properties of type double, for X, Y and Z components of coordinate properties (less desirable).

2. Implement a "Per-instance property provider" (a managed class that implements the IPropertyProvider interface from Autodesk.AutoCAD.ComponentModel, which BTW, they didn't bother to document), and have it expose whatever properties you want for the custom object. IPropertyProvider and the custom property attributes show above, together function as a managed equivalent of what you might use IDynamicProperty2 for providing properties to the OPM for. This is the preferred solution, although it has downside of providing properties universally (e.g., they will also show up in a PropertyGrid when the managed wrapper is set to the SelectedObject, which is a problem). You can also resort to dirty tricks like examining the call stack, to see if your IPropertyProvider is being called by Data Extraction, or by something else, and act accordingly.

The UnitType attribute is how you tell DataExtraction and other managed components that use System.ComponentModel, what type of data a double represents (e.g., a distance, angle, area, volume, etc.), so they can format those values accordingly.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5847976@discussion.autodesk.com...
Dear Developers

I have written a custom entity and exposed its properties via a com wrapper. I now want to link those properties to a Acad data table. I read up on the data extraction wizard, but when I select my object it doesn’t show any of my properties. I suspect I need to implement a managed wrapper as well. However, I tried to do the data extraction wizard on the SimpleSquare example (that does contain a com wrapper) but it still doesn’t show up in the data extraction wizard. Any advice?
Message 3 of 5
ChaosInACT
in reply to: Anonymous

actually if anyone could tell me why my visual studio (2012) won't allow me to use 

 

__property???

 

it demands 

 

Property

get

set

 

and won't work with the managed net wrapper....I'm going mad, lost a whole day on just this. 

 

I had if working with the new

 

Property

get

set

 

notation, but can't seem to pass a string that way (tells me string* is illegal in managed memory. I can SEE it working in polysamp=arrrrrgh!)

straight copy pastes from poysamp immediately tell me 

 

__property 

 

isn't aloud! so what should I be doing?

 

 

Message 4 of 5
3drios
in reply to: jprous

The __property syntax is the old clr style of property, use the Property Get and Set syntax instead. Set the Common Language Runtime Support settings to use /clr. 

 

The string* is old syntax so use string^ instead.

 

Good luck.

Message 5 of 5
ChaosInACT
in reply to: 3drios


@3drios wrote:

Good luck.


The world hates a smart **** 😉

 

I did work it out. Yeah, kinda out of date is the wizard it turns out.

 

I've had to learn c++ just for this project. ObjectARX has been just awesome  to cut my teeth on...

 

lol.

 

All joking aside thanks for the input - the more data out there the better for everyone and ObjectARX is a little ignored compared to .net nowadays.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost