• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    AutoCAD Architecture Customization

    Reply
    *Expert Elite*
    Keith.Brown
    Posts: 763
    Registered: ‎03-13-2008
    Accepted Solution

    Space Object Elevation Property

    157 Views, 1 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
    Please use plain text.
    *Expert Elite*
    Keith.Brown
    Posts: 763
    Registered: ‎03-13-2008

    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
    Please use plain text.