- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good day all,
I've done a bit of work on the on the lisp that @dlanorh wrote. the lisp he wrote placed different blocks (determined by the angle of the polyline) on each vertices of a polyline.
I've added "Branch code" that does the same, but for any branches connected to the main polyline (it must be selected by the user) and it places a joint (fibre joint) at the intersection point. It works, however there are cases where I have multiple branches so i need it to loop up until the user input stops.
The second problem that I have is when I select the branch and place the poles, it will place a 5m 150-175 pole along with a joint at the intersection, which is correct. However the main part of the code has already placed a pole on the intersection point and on top of that it will possibly place a thinner pole.
Would it be possible to have a thicker pole placed on the intersection point?
I've attached a sample DWG and a screencast of what I am trying to do.
(defun @delta (a1 a2)
(cond ( (> a1 (+ a2 pi)) (+ a2 pi pi (- a1)))
( (> a2 (+ a1 pi)) (- a2 a1 pi pi))
(t (- a2 a1))
)
)
(defun c:test ( / c_doc c_spc ent sp ep pt ang blk lang)
(setq c_doc (vla-get-activedocument (vlax-get-acad-object))
c_spc (vlax-get-property c_doc (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace))
ent (car (entsel "\nSelect Polyline : "))
sp 0.0
ep (vlax-curve-getendparam ent)
)
(while (<= sp ep)
(setq pt (vlax-curve-getpointatparam ent sp)
ang (angle '(0.0 0.0 0.0) (vlax-curve-getfirstderiv ent sp))
);end_setq
(cond ( (or (zerop sp) (= sp ep)) (setq blk "5m 150-175"))
(t (setq blk (if (< (abs (@delta lang ang)) (/ pi 12.0)) "5m 100-125" "5m 150-175")))
)
(vlax-invoke c_spc 'insertblock pt blk 1 1 1 0)
(setq sp (1+ sp) lang ang)
);end_while
; Possible code to prompt user if there are any branches
;Branch code - Repeat this up until user selection stops
;==============================================================================
(setq c_doc (vla-get-activedocument (vlax-get-acad-object))
c_spc (vlax-get-property c_doc (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace))
ent (car (entsel "\nSelect Polyline : "))
sp 0.0
ep (vlax-curve-getendparam ent)
)
(setq pt (vlax-curve-getpointatparam ent sp)); This sets first point for the joint to be placed
;Determining the joint size
(setq e (tblsearch "layer" (cdr (assoc 8 (entget ent))))) ;Searches for cable layer name
(setq CSize (cdr (assoc 2 e)))
(if (= CSize "36F Aerial")
(command "_.INSERT" "72F Joint" pt "" "")
(command "_.INSERT" "24F Joint" pt "" "")
);end_if
(while (<= sp ep)
(setq pt (vlax-curve-getpointatparam ent sp)
ang (angle '(0.0 0.0 0.0) (vlax-curve-getfirstderiv ent sp))
);end_setq
(cond ( (or (zerop sp) (= sp ep)) (setq blk "5m 150-175"))
(t (setq blk (if (< (abs (@delta lang ang)) (/ pi 12.0)) "5m 100-125" "5m 150-175")))
)
(vlax-invoke c_spc 'insertblock pt blk 1 1 1 0)
(setq sp (1+ sp) lang ang)
);end_while
)
)
Solved! Go to Solution.