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: 

Space Object Elevation Property

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Keith.Brown
1962 Views, 2 Replies

Space Object Elevation Property

I am trying to create a property definition that will display the elevation of a space object.  I looked through the automatic properties and did not find anything that looked like the elevation.

 

I have tried the following but was unable to achieve any success.

 

RESULT="--"
On Error Resume Next
Set AcadApp = GetObject(, "AutoCAD.Application")
Set Obj = AcadApp.Activedocument.Objectidtoobject("[ObjectID]")
RESULT = Obj.elevation

 

That formula does work if i swap elevation with say height, width,length or any of the properties found in the automatic property list that are a single word.  I know the elevation is there I just don't know how to access it. 

 

Any ideas?

2 REPLIES 2
Message 2 of 3
Keith.Brown
in reply to: Keith.Brown

I thought I would post the solution that I finally found for this issue.  The property that I really needed for the space object was its location.  The above method did not work because Location is a 3D vector and needed to be converted to an array.  Below is the solution that works for me.  Kudos to Hallex for pointing me in the right direction for another issue that led me to the solution to this problem.

 

On Error Resume Next
Set acadApp = GetObject(,"AutoCAD.Application") 

'ACADVER values:
'ACA 2010 = "18.0s (LMS Tech)" 
'ACA 2011 = "18.1s (LMS Tech)"
'ACA 2012 = "18.2s (LMS Tech)"
'ACA 2013 = "19.0s (LMS Tech)" 

acadVerString = acadApp.ActiveDocument.GetVariable("ACADVER")

'Set ACA application string, based on version running: 
Select Case acadVerString 

	Case "18.0s (LMS Tech)"  'ACA-2010 
		aecBaseVer = "AecX.AecBaseApplication.6.0" 

	Case "18.1s (LMS Tech)"  'ACA-2011 
		aecBaseVer = "AecX.AecBaseApplication.6.5" 

	Case "18.2s (LMS Tech)"  'ACA-2012 
		aecBaseVer = "AecX.AecBaseApplication.6.7"

	Case "19.0s (LMS Tech)"  'ACA-2013 
		aecBaseVer = "AecX.AecBaseApplication.7.0"

	Case "19.1s (LMS Tech)"  'ACA-2014
		aecBaseVer = "AecX.AecBaseApplication.7.5"

	Case Else 
		aecBaseVer = "Unknown" 

End Select 

If aecBaseVer = "Unknown" Then 
	RESULT = "Unknown Version" 
Else

	' Get an Utility object to convert the Vector3D to an Array
	Set aecBase = acadApp.GetInterfaceObject(aecBaseVer)
	aecBase.Init acadApp
	Set SpaceObject = acadApp.ActiveDocument.ObjectIDToObject([ObjectID])
	Set UtilityObject = aecBase.ActiveDocument.Utility

	' Get the Location of the Object and break down into individual X, Y, and Z parts
	SpaceObjectLocation = UtilityObject.ConvertToVariantArray(SpaceObject.location)
	LocationX = SpaceObjectLocation(0)
	LocationY = SpaceObjectLocation(1)
	LocationZ = SpaceObjectLocation(2)

	'Return the results
	RESULT = CStr(LocationZ)

End If

 

Message 3 of 3
freedom1k
in reply to: Keith.Brown

Thanks for the update Keith. I had an older version from DKoch. I took out the "CStr" conversion in the Results, so that my Data Formats are respected on objects.

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

Post to forums  

Autodesk Design & Make Report

”Boost