Jump to content

VLISP Example Modification Not Working


abra-CAD-abra

Recommended Posts

Trying to get to grips with VLISP by modifying example code to suit my needs, I have hit a brick wall with this one:

 

(defun c:Test (/ acadObj doc ss oML modelSpace sBlock MLval)

(vl-load-com)

;Modified VLISP example from Autodesk ActiveX Reference Guide
;Change MLeader content type from BLOCK to MTEXT assigning attribute value to text string

   (setq acadObj (vlax-get-acad-object))
   (setq doc (vla-get-ActiveDocument acadObj))
   (setq modelSpace (vla-get-ModelSpace doc))
   
   (setq ss (ssget "_:L" '((0 . "MULTILEADER"))))
 
   (repeat (setq i (sslength ss))
   (setq oML (vlax-ename->vla-object (ssname ss (setq i (1- i)))))
 
   (setq sBlock (vla-get-ContentBlockName oML))

   (vlax-for o (vla-Item (vla-get-Blocks doc) sBlock)
               (setq MLval (vla-GetBlockAttributeValue oML (vla-get-ObjectID o))) ;Read MLeader Block Attribute Value
               (vla-put-contenttype oML acMTextContent)    ;Change MLeader Content Type to MTEXT
               (vla-put-textstring oML MLval)                 ;Assign Attribute Value to MTEXT text string
   )
 )
   (vla-Update acadObj)
)

Can anybody help?

 

Cheers,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...