AutoCAD Architecture Customization

Reply
*Expert Elite*
Keith.Brown
Posts: 1,070
Registered: ‎03-13-2008
Message 1 of 3 (484 Views)
Accepted Solution

Space Object Elevation Property

484 Views, 2 Replies
12-18-2012 06:02 PM

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?


Keith Brown AutoCAD MEP BLOG | RSS Feed
AutoCAD MEP 2014 | Revit 2014 | EastCoast CAD/CAM V6.1 | Visual Studio 2013
────────────────────────────────────
⁞|⁞ Please use Mark Solutions!.Accept as Solution and Give Kudos!Give Kudos as appropriate. Thank you!
*Expert Elite*
Keith.Brown
Posts: 1,070
Registered: ‎03-13-2008
Message 2 of 3 (417 Views)

Re: Space Object Elevation Property

03-09-2013 03:46 PM 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

 


Keith Brown AutoCAD MEP BLOG | RSS Feed
AutoCAD MEP 2014 | Revit 2014 | EastCoast CAD/CAM V6.1 | Visual Studio 2013
────────────────────────────────────
⁞|⁞ Please use Mark Solutions!.Accept as Solution and Give Kudos!Give Kudos as appropriate. Thank you!
Active Contributor
freedom1k
Posts: 29
Registered: ‎06-20-2007
Message 3 of 3 (197 Views)

Re: Space Object Elevation Property

10-31-2013 08:24 AM 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.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community