
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm attempting to create a block from selected objects then rotate that block a specific angle. My code is below. When running the program it errors out at "(vla-rotate block ipt VPAng)" VPAng is the value I'd like to rotate the block by. IPT is the insertion point of the scaled block. When running with "IPT" I get this error:
"lisp value has no coercion to VARIANT with this type: (29605.1 15304.3 0.0)
lisp value has no coercion to VARIANT with this type: (29605.1 15304.3 0.0)"
When running with "BPT" as the basepoint I get this error:
"Automation Error: Description Was Not Provided"
Here's my code:
(defun MakeBlock (/ ss bpt name) ;ctrl+shift N
(prompt "\nSelect features for block")
(if (and (setq ss (ssget W)
bpt (getpoint "\nSelect Block Base Point")
ipt (polar Entpnt (* 1.5 pi) 2000)
name (getstring T "\nName: ")
yscale ScFac
)
(command "_.-BLOCK" name "_non" bpt
ss "" "_.oops" "_.-INSERT"
name "_S" 1 "_R" 0
"_non" ipt
)
)
(princ)
)
(setq block (entget (entlast))
block (vlax-ename->vla-object (cdr (car block)))
)
(vlax-put-property block "YEffectiveScaleFactor" yscale)
(vlax-put-property block "YScaleFactor" yscale)
(vla-rotate block ipt VPAng)
)
Can you tell me why it breaks in both cases and what needs to be done to correct it?
Thanks, Brad
Solved! Go to Solution.