Hello,
I'm hoping this is a silly question. I'm trying to correct the position of a dynamic block using calculated coordinates. Preferably not using the move command as that adds a layer of potential error.
This would be easy with a non-dynamic block, I just used (setpropertyvalue "Position/X" Northing) and it worked fine. I tried using LeeMac's (LM:setdynpropvalue) which works for the rest of the properties, but not with "Position/X" or "Insertion point X", which are what shows up when I do a dump of the block.
Failing that, I know a block can be temporarily treated as a dynamic block with (vlax-ename->vla-object a), can a dynamic block be temporarily treated as a regular one for one command?
The subfunction is here:
(defun FixSplcCs (blk / GripDist_X GripDist_Y OldAnno_X NewAnno_X OldAnno_Y NewAnno_Y TrgIns_X TrgIns_Y)
(setq GripDist_X (LM:getdynpropvalue blk "SPLICE GRIP X"))
(setq GripDist_Y (LM:getdynpropvalue blk "SPLICE GRIP Y"))
(if (or
(/= GripDist_X 0)
(/= GripDist_Y 0)) ; if either case grip point is non-zero
(progn ; then correct block position
(setq Insert_X Northing)
(setq Insert_Y Easting)
(setq OldAnno_X (LM:getdynpropvalue blk "SPLICE#/MODEL GRIP X"))
(setq OldAnno_Y (LM:getdynpropvalue blk "SPLICE#/MODEL GRIP Y"))
(setq TrgIns_X (+ Insert_X GripDist_X))
(setq TrgIns_Y (+ Insert_Y GripDist_Y))
(setq NewAnno_X (- OldAnno_X GripDist_X))
(setq NewAnno_Y (- OldAnno_Y GripDist_Y))
(LM:setdynpropvalue blk "Position/X" TrgIns_X) ;;<-- These two lines are the only ones not working. No error
(LM:setdynpropvalue blk "Position/Y" TrgIns_y) ;;<-- message, they just don't do anything
(LM:setdynpropvalue blk "SPLICE GRIP X" 0)
(LM:setdynpropvalue blk "SPLICE GRIP Y" 0)
(LM:setdynpropvalue blk "SPLICE#/MODEL GRIP X" NewAnno_X)
(LM:setdynpropvalue blk "SPLICE#/MODEL GRIP Y" NewAnno_Y)
(setq Northing TrgIns_X)
(setq Easting TrgIns_Y)
) ; end progn true
; (progn
; (setq Northing (getpropertyvalue blk "Position/X"))
; (setq Easting (getpropertyvalue blk "Position/Y"))
; ) ; end progn false
) ; end if
)
The full LISP is attached but is rather large. Thanks for any pointers.