- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The last couple lines of my code call the trim command on my newly inserted block (which is just a break line). The problem is that when I select objects to trim and there are more than one instance of this breakline dynamic block in the dwg file, the trim command thinks all of the blocks are participating and the user can trim lines around those blocks as well. I guess since they all have the same general name this is happening? I'm not a CAD expert, just a structural engineer helping our team with some coding (it's fun!!!).
Code below; help is appreciated!!
(defun c:gfds-bl (/ e)
(setq fqp "K:\\Blocks\\GA-BREAK.dwg")
(vl-load-com)
(setq thisdrawing (vla-get-activedocument
(vlax-get-acad-object)))
(setq mspace (vla-get-modelspace thisdrawing))
(setq util (vla-get-utility thisdrawing))
(setq ip (getpoint "\nStart Point: ")
fp (getpoint ip "\nEnd Point:"))
(setq l (distance fp ip)) ;length of block
(setq a (angle ip fp)) ;anghle between points
(setq x 1.0
y 1.0
z 1.0
r a)
(setq lyr (getvar "clayer")) ;;gets current layer
(command "-layer" "set" "S-TEXT" "")
(setq theblock (vla-InsertBlock mspace (vlax-3d-point ip) fqp x y z r))
(setvar "clayer" lyr)
(setq prp (strcase "Length"))
(vl-some
'(lambda ( x )
(if (= prp (strcase (vla-get-propertyname x)))
(progn
(vla-put-value x (vlax-make-variant l (vlax-variant-type (vla-get-value x))))
(cond (l) (t))
)
)
)
(vlax-invoke theblock 'getdynamicblockproperties)
)
(setvar "CMDECHO" 0)
(setq e (ssget "L"))
(command "TRIM" e "")
(princ)
);defun
Solved! Go to Solution.