;Bore by length
(defun C:TN2 (/ na nab lastent1 lastent2 pt1 pt2 o s)
(vl-load-com)
(command "-layer" "s" "LAND_BORE" "")
(setq na (getint "\nTotal Bore Length : "))
(setq nab (/ na 2.0))
(prompt "\nSelect Circle Centerpoint")
(command "circle" "nea" pause nab)
(setq lastEnt1 (entlast))
(SETQ PT1 (GETPOINT "\nSelect 1st Point:"))
(COMMAND "Circle" PT1 "D" "3.6")
(COMMAND "CHPROP" "L" "" "C" "RED" "")
(SETQ PT2 (GETPOINT "\nSelect 2nd Point:"))
(COMMAND "Circle" PT2 "d" "3.6")
(COMMAND "CHPROP" "L" "" "C" "RED" "")
(command "pline" PT1 PT2 "")
(setq lastEnt2 (entlast))
(setq o 1.7999999)
(setq s (ssget "L" '((0 . "*LINE,CIRCLE,ARC,ELLIPSE"))))
(foreach v (list o (- o))
(vla-Offset (vlax-EName->vla-Object (ssname s 0)) v)
)
(COMMAND "ERASE" LASTENT1 "")
(COMMAND "ERASE" LASTENT2 "")
(princ)
)
Thanks...certainly points to ponder.
(defun c:conduit ( / rad off oldsnap obj1 obj2 intpt ent
(vl-load-com)
(setq rad (/ (getreal "\nEnter length ") 2.0))
(setq off 1.7999999)
(setq ent (entsel "Pick obj point"))
(setq pt (cadr ent))
(setq pt (vlax-curve-getclosestpointto (vlax-ename->vla-object (car ent)) pt))
(setq obj1 (vlax-ename->vla-object (car ent)))
(command "circle" pt rad)
(setq obj2 (vlax-ename->vla-object (entlast)))
(setq intpt (vlax-invoke obj2 'intersectWith obj1 acExtendThisEntity))
(command "line" (list (nth 0 intpt)(nth 1 intpt))(list (nth 3 intpt)(nth 4 intpt)) "")
(setq ent (vlax-ename->vla-object (entlast)))
(vla-offset ent off)
(vla-offset ent (- 0.0 off))
(vla-delete obj2)
(vla-delete ent)
(command "circle" (list (nth 0 intpt)(nth 1 intpt)) 1.8 )
(command "circle" (list (nth 3 intpt)(nth 4 intpt)) 1.8)
(princ)
)
(c:conduit)
(defun C:FOO2 (/ TBL lastEnt1 lastEnt2 obj1 obj2 pts pt)
(vl-load-com)
(setvar 'cmdecho 0)
(if (tblsearch "layer" "LAND_BORE") ;if layer LAND_BORE exits switch to it else make it
(command "-layer" "_S" "LAND_BORE" "")
(command "-layer" "_M" "LAND_BORE" "")
)
(setq TBL (getint "\nTotal Bore Length : "))
(prompt "\nSelect Center point of Bore")
(command "_.Circle" "nea" pause "_D" TBL) ;use total bore lenth to create circle with diameter opiton like you use with smaller circles.
(setq lastEnt1 (entlast))
(setq obj1 (vlax-ename->vla-object (car (nentselp (getvar "lastpoint"))))) ;select polyline
(setq obj2 (vlax-ename->vla-object lastEnt1))
(setq pts (LM:intersections obj1 obj2 acextendnone)) ;use lee mac's intersection funciont to get points
(foreach pt pts
(command "_.Circle" pt "D" "3.6")
(command "_.Chprop" "L" "" "C" "1" "")
)
(command "_.Pline" pts "")
(command "_.Chprop" "L" "" "C" "1" "")
(setq lastEnt2 (entlast))
(vla-Offset (vlax-EName->vla-Object lastEnt2) 1.7999999)
(vla-Offset (vlax-EName->vla-Object lastEnt2) -1.7999999)
(command "_.Erase" LASTENT1 LASTENT2 "")
(setvar 'cmdecho 1)
(princ)
)
;; Intersections - Lee Mac
;; Returns a list of all points of intersection between two objects
;; for the given intersection mode.
;; ob1,ob2 - [vla] VLA-Objects
;; mod - [int] acextendoption enum of intersectwith method
(defun LM:intersections (ob1 ob2 mod / lst rtn)
(if (and (vlax-method-applicable-p ob1 'intersectwith)
(vlax-method-applicable-p ob2 'intersectwith)
(setq lst (vlax-invoke ob1 'intersectwith ob2 mod))
)
(repeat (/ (length lst) 3)
(setq rtn (cons (list (car lst) (cadr lst) (caddr lst)) rtn)
lst (cdddr lst)
)
)
)
(reverse rtn)
)
MHUPP your routine created the two smaller circles, but one was twice the size as the other and I don't believe it ever created the polyline to be offset.
(defun C:FOO2 (/ TBL lastEnt1 lastEnt2 obj1 obj2 pts pt)
(vl-load-com)
(setvar 'cmdecho 0)
(if (tblsearch "layer" "LAND_BORE") ;if layer LAND_BORE exits switch to it else make it
(command "-layer" "_S" "LAND_BORE" "")
(command "-layer" "_M" "LAND_BORE" "")
)
(setq TBL (getint "\nTotal Bore Length : "))
(prompt "\nSelect Center Point of Bore")
(command "_.Circle" "nea" pause "D" TBL) ;use total bore lenth to create circle with diameter opiton like you use with smaller circles.
(setq lastEnt1 (entlast))
(setq obj1 (vlax-ename->vla-object (car (nentselp (getvar "lastpoint"))))) ;select polyline
(setq obj2 (vlax-ename->vla-object lastEnt1))
(if (and (setq pts (LM:intersections obj1 obj2 acextendnone)) (= (length pts) 2))
(progn
(foreach pt pts
(command "_.Circle" pt "1.8")
(command "_.Chprop" "L" "" "C" "1" "")
)
(command "_.Pline" pts "")
(command "_.Chprop" "L" "" "C" "1" "")
(setq lastEnt2 (entlast))
(vla-Offset (vlax-EName->vla-Object lastEnt2) 1.8)
(vla-Offset (vlax-EName->vla-Object lastEnt2) -1.8)
(command "_.Erase" LASTENT1 LASTENT2 "")
)
(alert "You Need to Adjust Bore Length or Point on Polyline")
)
(setvar 'cmdecho 1)
(princ)
)
;; Intersections - Lee Mac
;; Returns a list of all points of intersection between two objects
;; for the given intersection mode.
;; ob1,ob2 - [vla] VLA-Objects
;; mod - [int] acextendoption enum of intersectwith method
(defun LM:intersections (ob1 ob2 mod / lst rtn)
(if (and (vlax-method-applicable-p ob1 'intersectwith)
(vlax-method-applicable-p ob2 'intersectwith)
(setq lst (vlax-invoke ob1 'intersectwith ob2 mod))
)
(repeat (/ (length lst) 3)
(setq rtn (cons (list (car lst) (cadr lst) (caddr lst)) rtn)
lst (cdddr lst)
)
)
)
(reverse rtn)
)