- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Afternoon everyone,
Hopefully someone can help me out with this.
I have a snippet of code that I found somewhere. Props to whomever made it and I wish I kept the location and person that posted it. What it does, is it allows me to move the attribute after the block is inserted into the drawing.
This is the part that is in my main LISP to insert the block then invoke the function.
(cond
(
(setq blk (vlax-invoke
(vlax-get
(vla-get-ActiveLayout
(vla-get-activedocument
(vlax-get-acad-object)))
'Block)
'InsertBlock ptcrv
blk2 1 1 1 ang))
(setq atb (Car (vlax-invoke blk 'Getattributes)))
(vla-put-textstring atb (strcat hgtnew " HP"))
(princ "\n<< Pick point for text location >>")
(_NextTrick (trans (vlax-get atb 'TextAlignmentPoint) 0 1) atb)
(setq inserted (cons blk2 inserted)
)
)
(
(and (setq str (eq (type ptcrv) 'STR))(eq ptcrv "U") inserted)
(vla-delete (car inserted))
(setq inserted (Cdr inserted)
counter (1- counter))
)
(str (princ "\nNothing to UNDO"))
)
Below is the subfunction that allows me to move the object.
(defun _NextTrick (pt obj / end code pt2)
(while
(and (null end)
(setq p (grread t 15 0)
code (car p)))
(cond
((= 5 code)
(vlax-put
obj
'TextAlignmentPoint
(setq pt2 (trans (cadr p) 1 0)))
(setq pt pt2)
)
((or (= 2 code) (= code 3))
(setq end T)))
)
);defun
What I am looking to do is modify this so that instead of using the text alignment to grab the text, I would like to use a dynamic block point to move parameter.
I know the area to edit is probably the 'TextAlignmentPoint to something else, but I dont understand where the 'TextAlignmentPoint comes from.
Also I cant seem to find much info on the VLAX-GET/VLAX-PUT function and how to use it/them.
Can anyone help out?
Solved! Go to Solution.