Yirmeyahu Posted June 9, 2022 Posted June 9, 2022 I am having trouble offsetteing a pline 6" and stretching the end points 6" after the pline has been exploded. Here is what I have so far. (defun C:DRW (/ ss n m sss) (command "._undo" "_begin") (setq c_doc (vla-get-activedocument (vlax-get-acad-object)) c_spc (vlax-get-property c_doc (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace)) sv_lst (list 'osmode 'cmdecho) sv_vals (mapcar 'getvar sv_lst) blk "DRW" ) (command "-layer" "m" "tempPB" "Color" "cyan" "" "Plot" "Plot" "" "Ltype" "continuous" "" "") (command "-layer" "thaw" "Anchor Bolt" "m" "Anchor Bolt" "Color" "blue" "" "Plot" "Plot" "" "Ltype" "continuous" "" "") (setq maxSpcng (getdist "\nPick or enter spacing or <6'>: ")) (if (= maxSpcng nil)(setq maxSpcng 72)) (if (setq ss (ssget "_:L" '((0 . "*POLYLINE") (8 . "Anchor Bolt")) )) (repeat (setq n (sslength ss)); repeat each edge (command "_.COPY" (ssname ss (setq n (1- n))) "" "0,0" "0,0") (command "_.chprop" "L" "" "LA" "tempPB" "") (command "_.explode" "L") ;;-+-----repeat each line of the edge ;;;line segment iteration------------------------------------------------------------------------------------ (repeat (setq m (sslength (setq sss (ssget "_P")))) (setq ent (ssname sss (setq m (1- m))) lin_dst (vlax-curve-getdistatparam ent (vlax-curve-getendparam ent)) NumSpcs (1+ (fix(/ lin_dst maxSpcng))) anchor_dist (/ lin_dst numspcs) iX 1 );end_setq (if (= 1 NumSpcs) (setq anchor_pt (vlax-curve-getpointatdist ent (* anchor_dist iX));;insertion - based on distance anchor_obj (vlax-invoke c_spc 'insertblock anchor_pt blk 1 1 1 0);;inserting the block ) (repeat NumSpcs (setq anchor_pt (vlax-curve-getpointatdist ent (* anchor_dist iX));;insertion - based on distance anchor_obj (vlax-invoke c_spc 'insertblock anchor_pt blk 1 1 1 0);;inserting the block ix (+ iX 1) ) ) );;END IF (command "erase" ent "") ) ); repeat each edge ; repeat each line in exploded selection set-------------------------------------------------------------------------------- ); if (command "-purge" "la" "tempPB" "n") (command "._undo" "_end") (princ) ); defun This is what I'm trying to accomplish. DRW.dwg Quote
BIGAL Posted June 9, 2022 Posted June 9, 2022 What may be simpler is offset pline and use a circle on each corner and trim. The circle rad = offset. Make circle then trim entlast and use vertice point. Erase circle. Quote
Yirmeyahu Posted June 14, 2022 Author Posted June 14, 2022 I thought there might be a simpler way to just stretch the end points instead of inserting circles or squares and then trimming. Inserting might be the best way though. Quote
BIGAL Posted June 14, 2022 Posted June 14, 2022 Try this has offset prefixed easy change to a user value. ; trim using circle at corners ; By AlanH Juen 2022 (defun c:trimc ( / rad of pt co-ord) (setq rad 0.2) (setq plent (entsel "\nPick pline ")) (vla-offset (vlax-ename->vla-object (car plent)) rad) (setq of (entlast)) (if of (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget of))))) (foreach pt co-ord (command "circle" pt rad) (setq c (entlast)) (command "trim" c "" pt "") (command "erase" c "") ) (princ) ) 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.