TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Peter2 on July 13, 2020, 09:32:34 AM

Title: How to get data from Property Pane?
Post by: Peter2 on July 13, 2020, 09:32:34 AM
Hi
The original "Property Pane" from AutoCAD shows sometimes properties of one or many elements which are not that easy to get - see the example here, taken from AutoCAD MAP with Industry Model, based on Oracle.
(https://autodesk.i.lithium.com/t5/image/serverpage/image-id/794699iA06DBC73CB58FF22/image-size/large?v=1.0&px=999)

So I think it is sometimes easier to analyse and use the data from Property Pane instead from the objects themselves.
Are there tools to get the data from the pane?
Or is my idea not that great as I think?
Title: Re: How to get data from Property Pane?
Post by: ribarm on July 13, 2020, 10:19:37 AM
Have you tried something like :
(dumpallproperties (car (entsel)))

Then to get/set you have :
(setpropertyvalue (car (entsel)) "Property" "Value")
(getpropertyvalue (car (entsel)) "Property")

"Property" and "Value" are just my examples - you should be using what you get/see when (dumpallproperties (car (entsel)))
Title: Re: How to get data from Property Pane?
Post by: Peter2 on July 13, 2020, 10:44:13 AM
Hi Marco

the problem that "MAP with Industry Model" (on oracle) has a dataflow in background which I don't know and uses for everything the object "AcMapBulkFeature". E.g dumping a text (similar to the example above) I get this:

Code - Auto/Visual Lisp: [Select]
  1. Objekt wählen: Begin dumping object (class: AcMapBulkFeature)
  2. Annotative (type: bool)  (LocalName: Beschriftung) = Failed to get value
  3. AnnotativeScale (type: AcString)  (RO)  (LocalName: Beschriftungs-Maßstab) = Failed to get value
  4. BlockId (type: AcDbObjectId)  (RO) = 16ea11089f0
  5. CastShadows (type: bool) = 1
  6. ClassName (type: AcString)  (RO) =
  7. CollisionType (type: AcDb::CollisionType)  (RO) = 1
  8. Color (type: AcCmColor)  (LocalName: Farbe) = VONLAYER
  9. ExtensionDictionary (type: AcDbObjectId)  (RO) = 0
  10. Handle (type: AcDbHandle)  (RO) = 9fc
  11. HasFields (type: bool)  (RO) = 0
  12. HasSaveVersionOverride (type: bool) = 0
  13. Hyperlinks (type: AcDbHyperlink*)
  14. IsA (type: AcRxClass*)  (RO) = AcMapBulkFeature
  15. IsAProxy (type: bool)  (RO) = 0
  16. IsCancelling (type: bool)  (RO) = 0
  17. IsEraseStatusToggled (type: bool)  (RO) = 0
  18. IsErased (type: bool)  (RO) = 0
  19. IsModified (type: bool)  (RO) = 0
  20. IsModifiedGraphics (type: bool)  (RO) = 0
  21. IsModifiedXData (type: bool)  (RO) = 0
  22. IsNewObject (type: bool)  (RO) = 0
  23. IsNotifyEnabled (type: bool)  (RO) = 0
  24. IsNotifying (type: bool)  (RO) = 0
  25. IsObjectIdsInFlux (type: bool)  (RO) = 0
  26. IsPersistent (type: bool)  (RO) = 1
  27. IsPlanar (type: bool)  (RO) = 0
  28. IsReadEnabled (type: bool)  (RO) = 1
  29. IsReallyClosing (type: bool)  (RO) = 1
  30. IsTransactionResident (type: bool)  (RO) = 0
  31. IsUndoing (type: bool)  (RO) = 0
  32. IsWriteEnabled (type: bool)  (RO) = 0
  33. LayerId (type: AcDbObjectId)  (LocalName: Layer) = 16ea110ed10
  34. LineWeight (type: AcDb::LineWeight)  (LocalName: Linienstärke) = -1
  35. LinetypeId (type: AcDbObjectId)  (LocalName: Linientyp) = 16ea1108950
  36. LinetypeScale (type: double)  (LocalName: Linientypfaktor) = 1.000000
  37. LocalizedName (type: AcString)  (RO) =
  38. MaterialId (type: AcDbObjectId)  (LocalName: Material) = 16ea1108dc0
  39. MergeStyle (type: AcDb::DuplicateRecordCloning)  (RO) = 1
  40. ObjectId (type: AcDbObjectId)  (RO) = 16ece87fe40
  41. OwnerId (type: AcDbObjectId)  (RO) = 16ea11089f0
  42. PlotStyleName (type: AcString)  (RO)  (LocalName: Plotstil) = VonFarbe
  43. ReceiveShadows (type: bool) = 1
  44. ShadowDisplay (type: AcDb::ShadowFlags)  (LocalName: Schattenanzeige) = 0
  45. Transparency (type: AcCmTransparency)  (LocalName: Transparenz) = 0
  46. Visible (type: AcDb::Visibility) = 0
  47. End object dump

And this is why I thought "Don't search for the real data - just take the displayed data" ....
Title: Re: How to get data from Property Pane?
Post by: jvillarreal on July 13, 2020, 11:57:33 AM
Look into the object data functions.
Here's one resource:
https://documentation.help/AutoCAD-Map-3D-2009-AutoLISP/object_data_functions.htm (https://documentation.help/AutoCAD-Map-3D-2009-AutoLISP/object_data_functions.htm)
Title: Re: How to get data from Property Pane?
Post by: tombu on July 13, 2020, 12:14:42 PM
Examples here: https://www.theswamp.org/index.php?topic=51728.0
The ade_odgetfield function from jvillarreal's link is the most common way to get that record but you need the Table name as well.
Title: Re: How to get data from Property Pane?
Post by: BIGAL on July 14, 2020, 02:19:08 AM
Object data has good references. Property data can also exist and is a bit of a nightmare to get at unless you have access to the right .dll's. Civ3d on its own is an example, the dll's are in Autocad Architecture but not Civ3d you can see them in the properties box. Creating them by external program can be done but how to retrieve programatically.
Title: Re: How to get data from Property Pane?
Post by: Rod on July 14, 2020, 02:50:28 AM
I did some experimenting with reading property sets using lisp, but I had to install an autocad architecture trial to get the required dlls.
See https://www.theswamp.org/index.php?topic=54460.msg598224#msg598224 (https://www.theswamp.org/index.php?topic=54460.msg598224#msg598224)
I haven't furthered it any more, just too busy.

Sounds like you are after object data anyway

+2 for ade_odgetfield
Title: Re: How to get data from Property Pane?
Post by: BIGAL on July 15, 2020, 12:19:48 AM
Thanks Rod it was a civ3d property set question and yes no .dll available. Just mentioned as property set data looks similar.
Title: Re: How to get data from Property Pane?
Post by: Peter2 on July 15, 2020, 04:30:11 AM
Thanks for the replies, but as written above - it is "Industry Model", and I could not get any access using the "ade_..." commands. Property Sets from Civil can be reached via Lisp, but I think that's not the solution here.

That's why I thought it's "easier" to used the existing data in Property Pane.

Peter
Title: Re: How to get data from Property Pane?
Post by: tombu on July 15, 2020, 10:50:14 AM
Why not just attach a small drawing with an object with the property data you want?
One of us could write the code to access the data you want like FID or LABEL_TEXT.
Your image simply isn't providing enough information.
Title: Re: How to get data from Property Pane?
Post by: Peter2 on July 20, 2020, 02:58:41 AM
Why not just attach a small drawing with an object with the property data you want?..
That's the problem with "Industry Model" - all the data is used and displayed in a "dynamic(?)" way, connected to the database. When you save a file, it changes the way of data handling, so an example file would not help.
Title: Re: How to get data from Property Pane?
Post by: wizman on July 20, 2020, 10:39:56 AM
Save current Map to AutoCAD then have the feature attributes exported as xdata.  Then you can play from there.
Title: Re: How to get data from Property Pane?
Post by: Peter2 on July 20, 2020, 11:24:36 AM
Thanks to all

I see that there are some ways, but my wish to a one-click-data-extract seem to impossible based on the knowledge and/or on the tools that I have.

Enjoy the summer!
Title: Re: How to get data from Property Pane?
Post by: BIGAL on July 21, 2020, 01:48:39 AM
Your giving up to quick its not that hard but need a dwg from you as the variables will be different names.
Title: Re: How to get data from Property Pane?
Post by: Peter2 on July 21, 2020, 02:50:11 AM
@BIGAL

thanks for your insistence. Here is a drawing, made from Map. There are many Texts, but the Acad command "list" shows one "Mapbulkfeature".

I'm really curious if
a) data can extracted from here and
b) if it will work in Industry Model
Title: Re: How to get data from Property Pane?
Post by: n.yuan on July 21, 2020, 11:51:43 AM
I saw your original post in Autodesk's "AutoCAD Map Developer" forum and hesitated to post reply, because you mentioned "IM" (Industrial Models) and "Object Data" in the title of your post. "Object Data" is Acad Map SPECIFIC approach to attach attribute to AutoCAD NATIVE entities, it does not mix with IM (at least, AFAIK). Plus, the picture posted is not in English (German, I guess?), it makes it a guess game to answer your question.

Now that you attached a drawing here under the insistence of the other repliers, I downloaded it and tried to open it. Of course, as you correctly pointed out, the drawing originally was connected to IM database. Without the DB connection, the drawing would show nothing meaningful. I could see that (based on the drawing file name), you probably tried to export the data into SDF file and connect to the drawing to the SDF file as FDO Map data source. But since you did not also provide the SDF file, the drawing would also not show the map feature data at all (except for an empty map layer in the drawing. Besides, while both IM data and FDO map source data would be shown in opened drawing in Acad Map as "MapBulkFeature", they are brought into drawing with different APIs: IM API and Acad Map Geospatial API (formerly called "Platform API").

AutoCAD Map has many sets of API to deal with "mapping" data:

1. Object Data is the earliest attempt Autodesk built for mapping, which ONLY applies to AutoCAD NATIVE entities, quite similar to XData/ExtensionDictionary attached to Acad entities. BTW, it is your mentioning of "Object Data" that confused some responders here (me included), thus some responds that relate to "Object Data" totally do not address your question.

2. Geospatial API, which connect Acad Map tp FDO sources (be it shape/SDF/geodatabase...) and visually presents the feature data as MapBulkFeature, which is not AutoCAD native entity.

3. IM API, which is "specialized geospatial" API to deal with feature data. similar to Geospatial API, but has its own set of API not only deals with the external feature data, but also provides some UI handing functionalities.

2 and 3 are all .NET APIs

IM is not widely used (I guess Autodesk now very regret that they have to bear the burden of supporting this rarely used API for years to come), many AutoCAD Map uses/programmers have not touched it, or even heard of it.

In your case, if you want to get information of MapBulkFeature's data (Feature's properties and associated geometry's properties), you DO NOT try to access the Properties Window, you need to use IM API to access them. There is huge amount of sample codes that comes with AutoCAD Map's installation at "C:\Program Files\AutoCAD20xx\Map\Development\Samples\". It would be quite some learning/studying ahead of you, if you have deal with IM with AutoCAD Map.

Some of the other responders mentioned "PropertySet Data". That does not apply to your IM related question. While "PropertySet Data" is yet another approach to attach attribute data in AutoCAD vertical, it is not available for pure AutoCAD Map, unless one uses AutoCAD Civil3D, which is built on top of AutoCAD Map.

Hope this at least provides some background information for you to look into.



Title: Re: How to get data from Property Pane?
Post by: Peter2 on July 21, 2020, 02:20:18 PM
Thanks n.yuan

for your detailed and high-class explanation.

I'm sorry about the "object data" confusion, it derived from "data / property / object property"..., so I added a screenshot, hoping it makes it clearer.
One year ago I was not aware that IM is so exotic  :?, but since then I saw that many of my questions stayed unanswered.

The code samples you mentioned are from VB.net and C#, and this is beyond my current knowledge. I hoped to find some ready-to-use code snippets or mini-executables, but I have to bury this vision.

Quote
(I guess Autodesk now very regret that they have to bear the burden of supporting this rarely used API for years to come),
"Support" is a rather elastic term ...
Title: Re: How to get data from Property Pane?
Post by: n.yuan on July 21, 2020, 03:58:16 PM
Because of using the term "Object Data", some tried to show you how to access Object Data in AutoCAD Map with VisualLisp code, which eventually led to you posting in AutoLisp forum here.

Lisp can access COM API via late-binding, thus can be used to manipulate Object Data in AutoCAD Map because Object Data is exposed via both COM API and .NET API.  Unfortunately, as I already pointed out, AutoCAD Map's IM API (and Geospatial API) is .NET API, which cannot be accessed by VisualLisp. So, the only way to solve your issue is to learn IM API (and AutoCAD/Map .NET) programming, using either VB.NET or C#.