AutoCAD Architecture Customization
Welcome to Autodesk’s AutoCAD Architecture Customization Forums. Share your knowledge, ask questions, and explore popular AutoCAD Architecture Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can I check ACA object properties?

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
jtm2020hyo
2535 Views, 12 Replies

How can I check ACA object properties?

I was learning AutoLISP and I found that (dumpallproperties (entsel)) can drop properties for AutoCAD objects.

Is there any equivalent for AutoCAD Architecture Objects? I tried again dumpallproperties but is incomplete, for example do not show object style name.

Tags (1)
12 REPLIES 12
Message 2 of 13
jtm2020hyo
in reply to: jtm2020hyo

Also using dumpallproperties drop error:

 

jtm2020hyo_0-1668530670402.png

 

Message 3 of 13
David_W_Koch
in reply to: jtm2020hyo

Try this:

 

(vlax-dump-object (vlax-ename->vla-object (car (entsel))))

 


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Message 4 of 13
jtm2020hyo
in reply to: David_W_Koch

Is there anything for custom Properties Set Definitions?

Message 5 of 13
David_W_Koch
in reply to: jtm2020hyo

You can get to those, but it is not a one-line expression.  You have to understand the AutoCAD Architecture object model, and how the Visual LISP ActiveX commands can be used to access it.

 

The AutoCAD object model is still in the online Help.  I have never been able to find the AutoCAD Architecture object model in the online Help, but maybe I am just not looking in the right place.  The old off-line help (way back in the 2010 release) had a lot of information on the object model for that release.  It has been a while since I last tried to access schedule property data on an AEC object.  If I recall correctly, it is not a straightforward thing, like dumping the "regular" properties of the object.

 

Here are the object model diagrams from the 2010 help.  Maybe someone else who has gotten into this level of customization for AutoCAD Architecture can point to where this sort of documentation is for more recent versions.

 

Snag_1f0732ec.png

 

Snag_1f079290.png

 

Snag_1f082d0b.png

 

Snag_1f0873e8.png

 

Snag_1f08c033.png

 


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Message 6 of 13
David_W_Koch
in reply to: jtm2020hyo

You can get to those, but it is not a one-line expression.  You have to understand the AutoCAD Architecture object model, and how the Visual LISP ActiveX commands can be used to access it.

 

The AutoCAD object model is still in the online Help.  I have never been able to find the AutoCAD Architecture object model in the online Help, but maybe I am just not looking in the right place.  The old off-line help (way back in the 2010 release) had a lot of information on the object model for that release.  It has been a while since I last tried to access schedule property data on an AEC object.  If I recall correctly, it is not a straightforward thing, like dumping the "regular" properties of the object.

 

Here are the object model diagrams from the 2010 help.  Maybe someone else who has gotten into this level of customization for AutoCAD Architecture can point to where this sort of documentation is for more recent versions.

 

Snag_1f0732ec.png

 

Snag_1f079290.png

 

Snag_1f082d0b.png

 

Snag_1f0873e8.png

 

Snag_1f08c033.png

 


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Message 7 of 13
David_W_Koch
in reply to: jtm2020hyo

@jtm2020hyo 

 

Here is an example of retrieving the value of a Property in a Property Set on a selected object.  Apologies for not making the variables local; I adapted code I had used to explore object data access and dumped it into a quick command function.  The code defines a custom command called WALLREMARKS.  The command prompts the user to select a Wall object.  You can select anything, but meaningful results will only be obtained if you select a Wall that has the WallObjects Property Set attached and that Property Set has a Remarks property defined in it.  If so, the value of the Remarks property is displayed on the command line.

 

(defun C:WallRemarks ()
  (setq	ent   (entsel "\Select Wall: ")
	ename (car ent)
	obj   (vlax-ename->vla-object ename)
  ) ;_ End setq.

  ;; Code to explore object model.
  (vl-load-com)
  ;; AutoCAD Application Object.
  (setq aa (vlax-get-acad-object))	; Holds the AutoCAD Application object.

  ;; AEC Schedule Applicaton Object.
  (setq	aecschd	(vla-GetInterfaceObject
		  aa
		  (strcat "AecX.AecScheduleApplication" ".8.2")
		)
					; Holds AecScheduleApplication object.
  ) ;_ End setq.

  (setq	oPSets (vlax-invoke-method aecschd 'PropertySets obj)
	iPSets (vlax-get-property oPSets 'Count)
	iPSet  0
  ) ;_ End setq.

  (while (< iPSet iPSets)		; While unprocessed property sets remain...
    (setq oPSet	  (vlax-invoke-method oPSets 'Item iPSet)
					; Get current property set object.
	  sPSetNm (vlax-get-property oPSet 'Name)
					; Get property set name.
    ) ;_ End setq.
    (if	(= (strcase sPSetNm) (strcase "WallObjects"))
      (setq iPSet (1+ iPSets))		; Target property set found, exit while loop.
      (setq iPSet (1+ iPSet))		; Increment property set counter.
    ) ;_ End if.
  ) ;_ End while.

  (cond					; Cond A.
    ((= iPSet iPSets)
     ;; If the property set is not found after processing all attached property sets, issue prompt.
     (prompt "\nWallObjects not found on selected object. ")
    ) ;_ End condition A1.
    (T
     (setq oProps (vlax-get-property oPSet 'Properties)
	   iProps (vlax-get-property oProps 'Count)
					; Total number of properties in the property set.
	   iProp  0
     ) ;_ End setq.

     (while (< iProp iProps)		; While unprocessed properties remain...
       (setq oProp   (vlax-invoke-method oProps 'Item iProp)
					; Get current property object.
	     sPropNm (vlax-get-property oProp 'Name)
					; Get property name.
       ) ;_ End setq.
       (if (= (strcase sPropNm) (strcase "Remarks"))
	 (setq iProp (1+ iProps))	; Target property found, exit while loop.
	 (setq iProp (1+ iProp))	; Increment property counter.
       ) ;_ End if.
     ) ;_ End while.

     (cond				; Cond A2B.
       ((= iProp iProps)
	;; If the property is not found after processing all properties in the property set, issue prompt.
	(prompt
	  "\nWallObjects:Remarks property not found on selected object. "
	)
       ) ;_ End condition A2B1.
       (T
	(setq varPropVal (vlax-get-property oProp 'Value)
	      sPropVal	 (vlax-variant-value varPropVal)
	) ;_ End setq.
	(prompt
	  (strcat
	    "\nRemarks property value = \""
	    sPropVal
	    "\"  "
	  ) ;_ End strcat.
	) ;_ End prompt.
       ) ;_ End condition A2B2.
     ) ;_ End cond A2B.

    ) ;_ End condition A2.
  ) ;_ End cond A.
  (prin1)
) ;_ End C:WallRemarks.

 

Just a little more than a single line.  😉  And all of that to get one property value!  To be fair, you would not have to repeat the entire thing for each additional property value.  You would only need to do the code up through finding the target Property Set once, then have a while loop searching for a given target Property for each target Property, saving the values to unique variables.  Then a single prompt could display all of the collected values.

 

Copy the above to Notepad (or any other plain text editor) and save it as an AutoLISP file (LSP extension).  Drag and drop the file into the AutoCAD canvas and the WALLREMARKS command will be defined.  Type WALLREMARKS at the command prompt and press the ENTER key to run the command.

 

NOTE:  This is written to run in AutoCAD Architecture 2020.  In line 15, change ".8.2" to ".8.3" for 2021, ".8.4" for 2022, or ".8.5" for 2023.


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Message 8 of 13
David_W_Koch
in reply to: jtm2020hyo

@jtm2020hyo 

 

I was considering writing a blog article about accessing AEC Property Data via AutoLISP, and discovered I had already written a set of three articles on that topic.  For you, or anyone else who comes across this thread, the articles provide a more detailed description of what the code is doing.

 

ACA-AMEP: Edit Property Data Via AutoLISP, Part 1

ACA-AMEP: Edit Property Data Via AutoLISP, Part 2

ACA-AMEP: Edit Property Data Via AutoLISP, Part 3


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Message 9 of 13
jtm2020hyo
in reply to: David_W_Koch

I received this message when I tried:

 

Command:
Command:
Command: WALLREMARKS
Select Wall:
WallObjects not found on selected object.
Command:

 
... I forgot something?

Message 10 of 13
David_W_Koch
in reply to: jtm2020hyo

The Wall you selected does not have a Property Set called WallObjects attached to it.  There is an out-of-the-box WallObjects Property Set Definition, that includes a Remarks property.  If you attach this to your Wall, then you should get the value of the Remarks property reported on the command line.


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Message 11 of 13
David_W_Koch
in reply to: jtm2020hyo

You can get the out-of-the-box WallObjects Property Set Definition attached to your Wall in at least two ways:

  • Use the out-of-the-box Wall Tag (Leader) tool and tag your Wall(s).
  • Use the Style Manager to import the Property Set Definition from the Schedule Tables (Imperial).dwg or Schedule Tables (Metric).dwg source files that ship with the US content.  (For those located outside of the US and not installing the US content, check your local content source files; I expect there will be something with out-of-the-box Property Set Definitions.)  Then select the Walls and use the Add Property Sets tool at the lower corner of the Extended Data tab of the Properties Palette to add the WallObjects Property Set.

David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
EESignature

Message 12 of 13
jtm2020hyo
in reply to: David_W_Koch

This info is very relevant, where do you found this info?

 

... and could share a visualisp sample to how add new property set data? I mean setting which object or style, which property add, which value for custom properties, which formula, etc.

... or where can I found such documentation to learn how to add custom properties to objects since visuallisp?

 

edit: where could I found the AutoCAD MEP object hierarchy?

Message 13 of 13
David_W_Koch
in reply to: jtm2020hyo

@jtm2020hyo 

 

The object model images are from the Help files that shipped with 2010 AutoCAD Architecture and 2010 AutoCAD MEP.  The MEP help did not include diagrams of the object model.

 

The Developer Documentation link in the online Help for AMEP 2025 takes you to the AutoCAD developer documentation, which does not appear to include information on AEC objects, but I have not searched extensively.

 

Most of what I know is from the old 2010 help files, things I have read in the forums, and a good deal of trial and error.  Almost all of my firm's work is now in Revit, so I have not had much call to maintain familiarity with this level of customization/automation for AutoCAD Architecture.

 

You may want to look into the resources available in the Autodesk Developer Network.  There may be a few there that know their way around the AMEP object model.


David Koch
AutoCAD Architecture and Revit User
Blog | LinkedIn
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