Hi All.
This lisp can to draw ditch from polyline and hatch it inside with option to change hatch properties:
;;; Draw ditch from polyline and hatch it inside with option to change hatch properties
;;; Combined from existing routines with great respect to it authors by Igal Averbuh 2017
(defun c:dhe
( / *error* GetHatchNames Sel Ent EntData oData nStyle BasePt HatchList Pos
TogAngle tempList tempPt tempData )
)
;--------------------------------
(defun GetHatchNames
( filePath
/ Opened tempStr tempPos tempName HatchList
)
)
(setq HatchList
(cons tempName HatchList
)) )
)
)
)
;------------------------------------
(setq Sel
(entsel "\n Select hatch to edit dynamicly: ")) )
"\r Current style: "
nStyle
" , Allow angle change: "
" [Style / Angle toggle]: "
)
)
)
)
Ent
)
41
;(/ (distance tempPt BasePt) (/ (getvar 'ViewSize) 5.))
)
EntData
)
)
tempData
)
)
)
)
)
)
EntData
)
)
)
)
)
)
)
)
)
)
)
)
(defun c:tl2
(/ AT:Offset ent pnt lst
) ;; Offset selected curve and connect each end (also option to convert to LWPolyline).
;; Copyright© Alan J. Thompson, 04.29.10
(defun OC1
(/ AT:Offset ent pnt lst
) ;; Offset selected curve and connect each end (also option to convert to LWPolyline).
;; Copyright© Alan J. Thompson, 04.29.10
(defun AT:Offset
(O D P
/ _pt p1 p2 c D g
) ;; Offset selected object
;; O - Object to offset
;; D - Distance to offset object
;; P - Point on side of object to offset
;; Alan J. Thompson, 09.12.09 / 03.25.10
)
)
)
)
)
)
)
)
)
)
(setq ent
(car (AT:
Entsel nil "\nSelect curve: " '
("L" (0 .
"ARC,LINE,SPLINE,LWPOLYLINE")) nil))) (alert "Invalid object!") )
)
)
'offsetdist
)
)
(setq lst
(list ent
(vlax
-vla
-object
->ename off
))) (alert "Cannot offset side of curve!") )
)
)
)
)
)
)
)
lst
)
lst
)
)
)
(cond ((getkword "\nConvert to closed LWPolyline? [Yes/No] <Yes>: ")) ("Yes")
)
)
)
(vl-cmdf "_.pedit" "_m" ss
"" "_y" "_j" "" "") (vl-cmdf "_.pedit" "_m" ss
"" "_j" "" "") )
)
)
)
)
)
)
(oc1)
(defun AT:Offset
(O D P
/ _pt p1 p2 c D g
) ;; Offset selected object
;; O - Object to offset
;; D - Distance to offset object
;; P - Point on side of object to offset
;; Alan J. Thompson, 09.12.09 / 03.25.10
)
)
)
)
)
)
)
)
)
)
(setq ent
(car (AT:
Entsel nil "\nSelect curve: " '
("L" (0 .
"ARC,LINE,SPLINE,LWPOLYLINE")) nil)))
(alert "Invalid object!") )
)
)
'offsetdist
)
)
(setq lst
(list ent
(vlax
-vla
-object
->ename off
))) (alert "Cannot offset side of curve!") )
)
)
)
)
)
)
)
lst
)
lst
)
)
)
(cond ((getkword "\nConvert to closed LWPolyline? [Yes/No] <Yes>: ")) ("Yes")
)
)
)
(vl-cmdf "_.pedit" "_m" ss
"" "_y" "_j" "" "") (vl-cmdf "_.pedit" "_m" ss
"" "_j" "" "") )
(command "-hatch" "s" ss
"" "p" "ANSI37" "5" "45" "") )
)
)
)
)
)
(c:tl2)
(c:dhe)
)
(c:tl)
as usual for me it working properly, but... "dirty".
Lisp have at least two problems
1. User need to select hatch inside closed polyline in order to change it properties, but this is (entlast) entity and no necessary to select it - just change
2. Inspide of the fact this lisp can work with splines:
(setq ent
(car (AT:
Entsel nil "\nSelect curve: " '
("L" (0 .
"ARC,LINE,SPLINE,LWPOLYLINE")) nil)))
in this case lisp start to work not properly (return error on stage of creating closed polyline)
I can fix this error if I change this string..
to this:
but in this case user need to select spline twice..
Is it possible to make some improvements in this combined routine?
Any help will be very appreciated