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

VB.NET Display XDATA in GridView Format For Palette

1 REPLY 1
Reply
Message 1 of 2
Anonymous
570 Views, 1 Reply

VB.NET Display XDATA in GridView Format For Palette

I am trying to create a custom palatte to display xdata in a gridview format from a certain application for my dwg files. This information will then have to be exported out to excel format. DOes anyone have sample code that they can share or give me direction on this task. Thanks.
Tags (2)
1 REPLY 1
Message 2 of 2
norman.yuan
in reply to: Anonymous

The task you want to do could be broken down into 3 things:

 

1. Gathering data to be displayed from XData attached to one or more entities;

2. Filling out/binding the obtained data to an UI component - a gridview;

3. Hosting the gridview in AutoCAD's PaletteSet;

 

So, if you search the Internet. or this forum on these narrowed topics, you might be able to find answers easier.

 

To collect XData of one or more entities, you need to decide how targeting entities are selected (manually, or using filter by code...). Once you have target entities determined, you can access XData by Entity.XData property or Entity.GetXDataForApplication() method. Since XData is an ResultBuffer object, an array of TypedValue data, the array could have 1 or more elements, you may want to develop a ggod data model (a class) to hold XData collected from entities in order to bind the data to UI component (IList, DataTable...)

 

To puplate/bind data to gridview, there are a lot discussioon you can find on the Internet. It also depends on which type of UI you use (Win form or WPF

 

Hosting gridview on PaletteSet implies that the displayed XData should be updated while user interacts with AutoCAD, for example, when the currently selected entities changed, because PaletteSet does not lock user interaction with AutoCAD, as a modal dialog does. So, you need to hook up your code that collecting XData and displaying it in UI with relevant AutoCAD events, such as DocumentBecameCurrent, ImpliedSelectionChanged, SelectionAdded/Removed...It depends on your application, and it is quite tricky.

 

Hopefully, you can work out some code and ask more concrete questions that would be easier for someone to answer.

Norman Yuan

Drive CAD With Code

EESignature

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

Post to forums  

Forma Design Contest


Autodesk Design & Make Report