+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Senior Member
    Computer Details
    guitarguy1685's Computer Details
    Operating System:
    Window 10
    Computer:
    Dell Precision Tower 5810
    Motherboard:
    Dell
    CPU:
    Intel Xeon ES-1620 v3 @ 3.5GHz
    RAM:
    16GB
    Graphics:
    Nvidia Quadro K4200
    Monitor:
    Dual Dell U2412m
    Discipline
    See details...
    guitarguy1685's Discipline Details
    Occupation
    CAD Manager
    Discipline
    See details below.
    Details
    Building envelops & AES
    Using
    AutoCAD 2017
    Join Date
    Oct 2009
    Posts
    292

    Default Vla-GetInterfaceObject what is this?

    Registered forum members do not see this ad.

    This is the code i'm currently working with to create an MleaderStyle

    Code:
    ;; original code by VVA
    (defun Create_MleaderStyle	(mleaderstylename
    				 MldScale
    				 /
    				; acaddoc
    				; mldrdict
    				; newldrstyle
    				 ;objcolor
    				)
      (vl-load-com)
      (setq acadobj		(vlax-get-acad-object)
    	acaddoc		(vla-get-activedocument acadobj)
    	mldrdict	(vla-item (vla-get-dictionaries acaddoc) "ACAD_MLEADERSTYLE")
      ) ;_ end of setq
      (setq	newldrstyle (vlax-invoke-method  mldrdict 'addobject mleaderstylename "AcDbMLeaderStyle"
    	 ) ;_ end of vlax-invoke-method
    	
      ) ;_ end of setq
      (setq	objcolor (vla-getinterfaceobject acadobj (strcat "AutoCAD.AcCmColor." (substr (getvar "acadver") 1 2)) ;_ end of strcat
    		   ) ;_ end of vla-getinterfaceobject       ;;what is vla-getinerfaceobject, and what am i retreiving?
    	) ;_ end of setq
      (vla-put-colorindex objcolor 2)
      (vla-put-textcolor newldrstyle objcolor)      ;;howcome I have to set color this way instead of the alternate in code below
      (vla-put-colorindex objcolor 0)
      (vla-put-leaderlinecolor newldrstyle objcolor)
    
    
      (foreach item
    	   (list
    	     
    	     '("AlignSpace" 0.18)
    	     '("Annotative" 0)
    	     '("ArrowSize" 0.125)
    	     ;'("ArrowSymbol" "")
    	     '("BitFlags" 0)
    	     ;'("Block" "")
    	     '("BlockConnectionType" 0)
    	     '("BlockRotation" 0.0)
    	     '("BlockScale" 1.0)
    	     '("BreakSize" 0.125)
    	     '("ContentType" 2)		;mtext
    	     '("Description" "")
    	     '("DoglegLength" 0.125)
    	     '("DrawLeaderOrderType" 0)
    	     '("DrawMLeaderOrderType" 1)
    	     '("EnableBlockRotation" -1)
    	     '("EnableBlockScale" -1)
    	     '("EnableDogleg" -1)
    	     '("EnableFrameText" 0)
    	     '("EnableLanding" -1)
    	     '("FirstSegmentAngleConstraint" 0)
    	     '("LandingGap" 0.09)
    	     '("LeaderLineType" 1)
    	     '("LeaderLineTypeId" "ByBlock")
    	     '("LeaderLineWeight" -2)
    	     '("MaxLeaderSegmentsPoints" 0)
    	     (list "ScaleFactor" MldScale)
    	     '("SecondSegmentAngleConstraint" 0)
    	     '("TextAlignmentType" 0)
    	     '("TextAngleType" 0)
    	     '("TextAttachmentDirection" 0)
    	     '("TextBottomAttachmentType" 0)
    	     '("TextHeight" 0.09375)
    	     '("TextLeftAttachmentType" 1) 
    	     '("TextRightAttachmentType" 1)
    	     '("TextString" "")
    	     '("TextStyle" "StyleName")			;need to add check for existing
    	     '("TextTopAttachmentType" 0)
    	   ) ;_ end of list
    
        (vlax-put newldrstyle (car item) (cadr item))
      ) ;_ end of foreach
      newldrstyle
    ) ;_ end of defun
    How come this wont wont? I've tried it, it wont work.

    Code:
    (vlax-put-property (vlax-get-property newldrstyle 'Textcolor) 'ColorIndex 5)

  2. #2
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,901

    Default

    Have a look at "acadver" it returns a different number for every version of Autocad etc Sometimes when opening the Autocad database you have to use the correct number with a version. For this reason I have some code that checks which version is running before opening the, in my case CIV3D database.

    Code:
    ((vl-string-search "R20.0" vrsn)(setq appstr "10.4"));;2015
    ((vl-string-search "R20.1" vrsn)(setq appstr "10.5"));;2016     
     ((vl-string-search "R21.0" vrsn)(setq appstr "11.0"));;2017
    A man who never made mistakes never made anything

  3. #3
    Senior Member
    Computer Details
    guitarguy1685's Computer Details
    Operating System:
    Window 10
    Computer:
    Dell Precision Tower 5810
    Motherboard:
    Dell
    CPU:
    Intel Xeon ES-1620 v3 @ 3.5GHz
    RAM:
    16GB
    Graphics:
    Nvidia Quadro K4200
    Monitor:
    Dual Dell U2412m
    Discipline
    See details...
    guitarguy1685's Discipline Details
    Occupation
    CAD Manager
    Discipline
    See details below.
    Details
    Building envelops & AES
    Using
    AutoCAD 2017
    Join Date
    Oct 2009
    Posts
    292

    Default

    Yes, i get that part

    So the line evaluates like this essentially.

    Code:
    (setq objcolor (vla-getinterfaceobject acadobj "AutoCAD.AcCmColor.21") )
    This gives me this

    Code:
    objcolor = '#<VLA-OBJECT IAcadAcCmColor 000001607b35b8b0>
    What is this? Is this a color? Which object does this color belong to? It's used here like this
    Code:
      (vla-put-colorindex objcolor 2)
      (vla-put-textcolor newldrstyle objcolor)      
      (vla-put-colorindex objcolor 0)
      (vla-put-leaderlinecolor newldrstyle objcolor)
    Why cant I just do this

    Code:
    (vlax-put-property (vlax-get-property newldrstyle 'Textcolor) 'ColorIndex 5)

  4. #4
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,901

    Default

    Registered forum members do not see this ad.

    Use the vlax-dump-object and look at what comes out it may help to work out whats going on, the styles can rely on a different levels being changed rather than going further down the tree stucture. I did find something that pointed to where you may be able to do direct I will have to do again.
    A man who never made mistakes never made anything

Similar Threads

  1. Replies: 1
    Last Post: 25th Aug 2013, 11:00 pm
  2. Getinterfaceobject causes application error with 64bit win7
    By M76 in forum .NET, ObjectARX & VBA
    Replies: 7
    Last Post: 24th Feb 2013, 01:03 pm
  3. GetInterfaceObject Issues in AutocadMap 2011 windows 7 64 bit
    By VivekGIS in forum .NET, ObjectARX & VBA
    Replies: 3
    Last Post: 24th Feb 2013, 12:25 am
  4. VLA-GETINTERFACEOBJECT on 64 bit Windows 7
    By tfurness in forum AutoLISP, Visual LISP & DCL
    Replies: 12
    Last Post: 12th Sep 2012, 03:21 pm

Bookmarks

Posting Permissions

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