(defun c:bln(/ oldattreq oldlayer p p1 ro)
(defun LM:setdynpropvalue ( blk prp val )
(setq prp (strcase prp))
(vl-some
'(lambda ( x )
(if (= prp (strcase (vla-get-propertyname x)))
(progn
(vla-put-value x (vlax-make-variant val (vlax-variant-type (vla-get-value x))))
(cond (val) (t))
)
)
)
(vlax-invoke blk 'getdynamicblockproperties)
)
)
(setq osm (getvar "osmode")) ;autosnap
(setvar "osmode" 0) ;autosnap
(setq oldattreq (getvar "attreq"))
(setvar "attreq" 1)
(setq oldlayer (getvar "clayer"))
(setq p (getpoint "\nLocation of balloon center: "))
(setq p1 (getpoint p "\nPick End location of leader: "))
(setq ro (/ (* (angle p p1) 180) pi)) ;Rotation or set it as you required
(setq scale (getvar "dimscale"))
(command "_.layer" "s" "0" "")
(command "_.insert" ;Starts the inset command
"K:\\Blocks\\Roberts_blocks\\BALLOON.dwg"
p ;insertion point, defined earlier
scale ;X scale
;scale ;Y scale uniform
"0" ;Rotation or set it as you required
)
(LM:setdynpropvalue (vlax-ename->vla-object (entlast)) "Distance1" (Distance p p1))
(LM:setdynpropvalue (vlax-ename->vla-object (entlast)) "Angle1" (angle p p1))
(command "_.wipeout" "F" "OFF") ;Disables the baked-in wipeout frame: hides edge visibility
(setvar "attreq" oldattreq) ;reset the value to the before state
(setvar "clayer" oldlayer) ;same as above, but for layers
(setvar "osmode" osm) ;autosnap
(princ)
)
;End Addition
I've added the code for the insertion, it slipped my mind earlier.
Additionally, I've used the break on error to find that the line causing issues is:
'(lambda ( x ) (if (= prp (strcase (vla-get-propertyname x))) (progn (vla-put-value x (vlax-make-variant val (vlax-variant-type (vla-get-value x)))) (cond (val) (t))
Any ideas?