See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Access and extract property set information through lisp

  1. #1
    Member
    Join Date
    2003-12
    Posts
    16
    Login to Give a bone
    0

    Default Access and extract property set information through lisp

    I have 100+ 3dpolylines from which I want to export information to Excel (name/number, lenght, startpoint, ...).
    The name:number is stored as an integer in a property set (Name:number).

    Making a list of the 3dpolylines, looping through the list, getting the other information and exporting to Excel is working fine.
    The only thing I cannot work out is getting the "name:number" into a variable . Is there any way to access this value through lisp?

    Capture.JPG

    Regards Bernt

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    1

    Default Re: Access and extract property set information through lisp

    You're looking to get Object Data from those 100+ 3dpolylines. As the data can be arranged in many ways there's no pet answer, but this link should get you started:
    Getting Object Data from an Entity.. https://forums.autodesk.com/t5/visua...y/td-p/2797458

  3. #3
    Member
    Join Date
    2003-12
    Posts
    16
    Login to Give a bone
    0

    Default Re: Access and extract property set information through lisp

    I appriciate your response, but unfortunately I could't get it to work.

    (ade_odgettables (entsel)) returned "nil". There was nothing to return.

    I have also tried the function that Mr Lee Mac has written to see what is stored at each object.
    http://www.lee-mac.com/dumpobject.html
    The property set/extended data does not show here either.

    I can access and set a value with "-PROPERTYDATAEDIT", but so far I can't get anything out.

    bernt

  4. #4
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,667
    Login to Give a bone
    0

    Default Re: Access and extract property set information through lisp

    Lee Mac's routine is to list all the Properties and methods of an AutoCAD object.

    Not sure what you thought the code you entered would do, but after loading the code from the link I sent you I entered
    Code:
    (od_value "TAXID")
    at the command line and got the value of TAXID from a selected polyline imported from an ESRI shape file with Map 3D.

    Load the code from the link I sent you and try
    Code:
    (od_value "Number")
    at the command line and select a polyline. It should give you the value of Number.

    As I said before the data can be arranged in many ways there's no pet answer. Try doing a Google search on "lisp Object Data" to find out more about it and keep in mind it has nothing to do with "Object Properties" even though "Object Data" is listed in the Properties Palette.

  5. #5
    Member
    Join Date
    2003-12
    Posts
    16
    Login to Give a bone
    0

    Default Re: Access and extract property set information through lisp

    Thank you for help Mr Beauford.

    It took me a while to understand that you were suggesting a slightly different approach than I originally looked at.
    After some investigation I have found that there is (at least) 3 ways to add additional data to an object:

    1 xdata.
    Needs programming, difficult for the average user to view and edit.

    2 Property sets
    Easy to set up and edit for the average user. Supports ifcexport.
    I never found out how to programatically access this value.

    3 Object data
    Easy to set up and edit for the average user. Programatically accessible.
    Does not support ifc-export (afaIk)

    I didn't need IFC-export this time, and I ended up with switching from "propety sets" to "object data", as it did what I needed
    when I was extracting data and exporting the result to Excel. Exactly as you suggested. And it probably will do well in most
    other cases.

    However it would be nice to be able to access "property sets" in the same way, if IFC-export one day should be requiered in
    addition to Excel-export (of course for valid objects).


    Regards Bernt

  6. #6
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Access and extract property set information through lisp

    I always wondered why there wasn't a native LISP function to find the properties of an object
    and return a list of sublists with the property name and the property value.

    Here is the lisp version.

    Maybe this will help you or others who wondered the same thing.

    P=



    Code:
    ;___________________________________________________________________________________________________________|
    ;
    ; Written By: Peter Jamtgaard C.E., P.E., S.E. copyright 2018 All Rights Reserved
    ;___________________________________________________________________________________________________________|
    ;
    ; Any use by unauthorized person or business is strictly prohibited.
    ;___________________________________________________________________________________________________________|
    
    ;___________________________________________________________________________________________________________|
    ;
    ; Comand line function list
    ;___________________________________________________________________________________________________________|
    
    ;* C:PropertyDump
    ;* Command line function to dump a list of property names and values of a selected object to a list
    
    ;___________________________________________________________________________________________________________|
    ;
    ; General Function Header List
    ;___________________________________________________________________________________________________________|
    
    ;  Function List Argument1 Argument2 Arguement3
    
    ;* (PropertyList objSelection)
    ;* Function to create a list of sublists of property names and values of an object argument
    
    ;* (PropertyNames objSelection)
    ;* Function to create a list of property names that available to an object
    
    ;* (PropertyValue objSelection strProperty)
    ;* Function to get a property value from an object (neglecting COORDINATE because it has more than one arg.)
    
    ;$ End Header
    
    ;___________________________________________________________________________________________________________|
    ; 
    ; Command line function to dump a list of property names and values of a selected object to a list
    ;___________________________________________________________________________________________________________|
    
    (defun C:PropertyDump (/ entSelection lstSelection objSelection)
     (if (and (setq lstSelection (entsel "\nSelect Object: "))
              (setq entSelection (car lstSelection))
              (setq objSelection (vlax-ename->vla-object entSelection))
         )
      (PropertyList objSelection)
     )
    )
    
    ;___________________________________________________________________________________________________________|
    ; 
    ; Function to create a list of sublists of property names and values of an object argument
    ;___________________________________________________________________________________________________________|
    
    
    (defun PropertyList (objSelection / lstProperties strProperty)
     (if (and (setq lstProperties (PropertyNames objSelection))
              (setq lstProperties (acad_strlsort lstProperties))
         )
      (mapcar '(lambda (strProperty)(list strProperty (propertyvalue objSelection strProperty))) lstProperties)
     )
    )
    
    
    
    ;___________________________________________________________________________________________________________|
    ; 
    ; Function to create a list of property names that available to an object
    ;___________________________________________________________________________________________________________|
    
    
    (defun PropertyNames (objSelection / lstProperties strFunctionName)
     (foreach strFunctionName (atoms-family 1)
      (if (= (strcase (substr strFunctionName 1 7) T) "vla-get")
       (if (vlax-property-available-p objSelection (substr strFunctionName 9))
        (setq lstProperties (cons (substr strFunctionName 9) lstProperties))
       )
      )
     )
     (reverse lstProperties) 
    )
    
    
    
    ;___________________________________________________________________________________________________________|
    ; 
    ; Function to get a property value from an object (neglecting COORDINATE because it has more than one arg.)
    ;___________________________________________________________________________________________________________|
    
    (defun PropertyValue (objSelection strProperty)
     (if (= (type objSelection) 'ENAME)
      (setq objSelection (vlax-ename->vla-object objSelection)))
     (if (= strProperty "COORDINATE")
      T
      (vlax-get objSelection strProperty)
     )
    )
    
    (vl-load-com)
    Attached Files Attached Files
    AutomateCAD

  7. #7
    Member
    Join Date
    2003-12
    Posts
    16
    Login to Give a bone
    0

    Default Re: Access and extract property set information through lisp

    Update for anybody interested.

    In a particular project we are working with "Status" as a Property set in Civil3d used together with Navisworks.

    After some time on Google I stumbeled upon a solution to working with property sets in a 15 yrs old thread.
    Mr Bobby Jones has a solution for extracting property data.

    https://forums.autodesk.com/t5/autoc...ns/td-p/490741

    The example code needs a minor adjustment regarding AutoCAD version, but after looking into it and changing the code it to my project settings I was able to make it work.
    I found it useful to refine the extraction of a property set value to a variable with "vl-princ-to-string" to make it more useful in later use.

    Regards
    Bernt

  8. #8
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    560
    Login to Give a bone
    0

    Default Re: Access and extract property set information through lisp

    I am trying to solve same problem.

    (setq schedApp (vla-getInterfaceObject (vlax-get-acad-object) "AecX.AecScheduleApplication.x.x")) ; change x.x for 2020
    the aecx. does not exist.


    (setq schedApp (vla-getInterfaceObject acadObj "AeccXUiLand.AeccApplication.13.2") ; this is CIV3d 2020

  9. #9
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    560
    Login to Give a bone
    0

    Default Re: Access and extract property set information through lisp

    Thanks berndt for the message please post here any code may be useful.

    I do not have Aecx.dll so tried a few others that sounded correct.

    On another post talked about looking at the applications available in the dll but that's involving .net programming.

  10. #10
    Member
    Join Date
    2003-12
    Posts
    16
    Login to Give a bone
    0

    Default Re: Access and extract property set information through lisp

    See attachment for the code I used. The secondary lsp (psd.lsp) has been modified to work
    with 2019 (acadObj "AecX.AecScheduleApplication.8.1"). Thanks to mr Bobby Jones for his code,

    There are two folder specific lines in the main file (propertysets-2019.lsp).
    It consists of 6 different commands:
    1 Insert template with property set, so the code can be used with any file
    2 Set property set on selected objects and set default property value to "not set"
    3 Set colors on objects to have a visual representation of the value
    4 Put the colors back to bylayer
    5a Isolate all objects to have a visual representation where value is "not set"
    5b Unisolate

    Please note: This code requires AutoCad Architecture to be installed at the same computer. Maybe only some dlls.
    I accidently discovered that when a co-worker couldn't make this work. Unfortunately I have not been able to make
    it work with C3D only.

    Regards
    Bernt
    Attached Files Attached Files
    Last edited by bernt.noodt; 2020-02-27 at 04:10 PM.

Page 1 of 2 12 LastLast

Similar Threads

  1. Easily extract information from a PDF into a database
    By thomas.stright in forum Software
    Replies: 1
    Last Post: 2006-12-20, 09:47 PM
  2. Extract entity information from within an xref
    By marc.primaroh in forum AutoLISP
    Replies: 2
    Last Post: 2006-04-10, 11:34 AM
  3. Replies: 5
    Last Post: 2006-03-02, 12:15 PM
  4. Script to extract attribute information
    By sifuentes in forum AutoCAD Customization
    Replies: 1
    Last Post: 2005-07-07, 01:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •