Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Hatch between two lines

12 REPLIES 12
Reply
Message 1 of 13
vbecerra
5934 Views, 12 Replies

Hatch between two lines

Is there a way to hatch between two lines even though they are not enclosed?
12 REPLIES 12
Message 2 of 13
Anonymous
in reply to: vbecerra

yes... just select the lines. The hatch will go only as far as the lines overlap.
Message 3 of 13
Anonymous
in reply to: vbecerra

Type "hatch" at the command line and
follow the prompts and you will be asked
to pick points to hatch between.

Mark Major
Message 4 of 13
Anonymous
in reply to: vbecerra

Try this simple procedure:



Using lisp, draw a pline using the endpoints of the

2 lines. Call bhatch command using the pline as the

boundary. After hatching, erase the pline.



Leo
Message 5 of 13
Anonymous
in reply to: vbecerra

I have a routine called POCHE that will hatch between two lines or
polylines, and it doesn't even need the second line (you tell it how far and
on which side to go from the base line. It's shareware, but there's no cost
to try it:

POCHE.LSP or POCHE.VLX at http://www.turvill.com/t2/shareware.htm
___

"vbecerra" wrote in message
news:f0fd4ee.-1@WebX.maYIadrTaRb...
> Is there a way to hatch between two lines even though they are not
enclosed?
Message 6 of 13
Anonymous
in reply to: vbecerra

For get the shareware.

Works with just LINES and you don't need to tell it anything.

Based off a stud wall, will scan for other side, but to only a given
distance.

Modify as you wish, I also have a different one for point to point.
I wrote it about 5 years ago, playing around.

(defun C:ha1 (/ tpick pt ent b1 b2 owinf
basept inf entla entdis entang dist1 dist2
opbase cnt
)


(setq ent nil)
(setq ent (entsel "\nSelect wall..."))


(setq tpick (getvar "pickbox"))

(setvar "pickbox" tpick)

(if ent
(setq basept (cdr ent)
inf (entget (car ent))
b1 (cdr (assoc 10 inf))
b2 (cdr (assoc 11 inf))
entla (cdr (assoc 8 inf))
entty (cdr (assoc 0 inf))
entdis (distance b1 b2)
entang (angle b1 b2)
dist1 (distance b1 (car basept))
dist2 (distance b2 (car basept))
)
)

(if (not (= entty "LINE"))(setq ent nil))
(if ent
(setq cnt 1)
)

(while cnt

(if (and ent (<= dist1 dist2))
(setq a (angle b1 b2))
(setq a (angle b2 b1))
)

(if (and ent (<= dist1 dist2))
(setq opbase (polar b1 (+ a (dtr 0)) dist1)
pt b1
)
(setq opbase (polar b2 (+ a (dtr 0)) dist2)
pt b2
)
)
(setq cnt nil)
)


(setvar "pickbox" 0)
(if ent
(setq cnt 1)
)


(while cnt
(if cnt
(setq owid1 (polar opbase (+ a (dtr 90)) cnt))
)
(if (and ent (nentselp owid1))
(princ (ha-wall-layer1))
)
(if cnt
(setq cnt (+ cnt 1))
)
(if (and cnt (= cnt 13))
(setq cnt nil)
)
)




(if (and ent (= owinf nil))
(setq cnt 1)
)

(while cnt
(if cnt
(setq owid1 (polar opbase (+ a (dtr -90)) cnt))
)
(if (and ent (nentselp owid1))
(princ (ha-wall-layer1))
)
(if cnt
(setq cnt (+ cnt 1))
)
(if (and cnt (= cnt 13))
(setq cnt nil)
)
)




(setvar "pickbox" tpick)
(if ent
(princ (c:ha1))
)
(setq ent nil)
(princ)
)
(princ)



(defun ha-wall-layer1 (/ tru-ent owb1 owb2
owentla owentdis owentang cl ndis
basept2 nang npoint npoint2 tmp1 tmp2
)

(setq tru-ent (nentselp owid1))

(if tru-ent
(setq owinf (entget (car tru-ent))
basept2 (cdr tru-ent)
owb1 (cdr (assoc 10 owinf))
owb2 (cdr (assoc 11 owinf))
owentla (cdr (assoc 8 owinf))
owentty (cdr (assoc 0 owinf))
owentdis (distance owb1 owb2)
owentang (angle owb1 owb2)
)
)

(if (and ent (= owentla entla)(= owentty "LINE"))
(progn
(setq nang (angle (car basept) (car basept2)))

(setq npoint (inters (car basept) (car basept2) owb1 owb2 nil))
(setq ndis (distance (car basept) npoint))
(setq npoint2(inters npoint (car basept) b1 b2 nil))
(setq tmp1 (polar npoint (+ entang (dtr 90)) 100))
(setq tmp2 (polar npoint (+ entang (dtr -90)) 100))
(setq npoint (inters tmp1 tmp2 owb1 owb2))
(setq nang (angle npoint2 npoint))

(setq ndis (distance npoint npoint2))
(setq owb1 (polar b1 (+ nang (dtr 0)) ndis))
(setq owb2 (polar b2 (+ nang (dtr 0)) ndis))

(setq cl (getvar "clayer"))
(setvar "clayer" cl)
(setvar "pickbox" tpick)

(if (= (tblsearch "layer" "screen1") nil)
(command "layer" "m" "screen1" "c" "c" "screen1" "")
)
(setvar "clayer" "screen1")
(setq cnt nil)

(command "hatch" "ansi31" "20" (+ (rtd entang) 45) "" "n" b1 b2 owb2
owb1 "c" "")

(setvar "clayer" cl)
)
)

(princ)
)



Rudy@cadentity.com

"vbecerra" wrote in message
news:f0fd4ee.-1@WebX.maYIadrTaRb...
Is there a way to hatch between two lines even though they are not enclosed?
Message 7 of 13
Anonymous
in reply to: vbecerra

My company's standard for the partition wall load is to show a single line with 240mm width hatch over the line.

Is that possible to have this lisp to do it. I tried but failed. please help me out.

Thanks a lot

Ting
Message 8 of 13
Anonymous
in reply to: vbecerra

Why not simply insert a block?
Message 9 of 13
Anonymous
in reply to: vbecerra

We have to trace Arch. drawings where they shown partition wall.

I try to find a easy way instead to draw outline of the wall - hatch it- drawing a line in the middle of the wall-remove the outline of the wall.

It's my company's standard who to show the load of the partition wall. I have to follow. That's why I'm here to search a lisp which will help me out...
Message 10 of 13
Anonymous
in reply to: vbecerra

Why not draw the centre line then offset +/- 120mm to get the outer lines, hatch between the outer lines then erase the outer lines? Could be quicker than trying to automate the centre line... (Possibly best to use polylines). Hugh Adamson Cadro Pty Ltd
Message 11 of 13
Anonymous
in reply to: vbecerra

Hello! ------- Ting do you can post an image? Maybe you have to create a Linetype for this? ------------------------------ Alexander V. Koshman
Message 12 of 13
Anonymous
in reply to: vbecerra

try this:

(defun C:hatchwithin2lines ()
(vl-load-com)
(setq adoc
(vla-get-activedocument
(vlax-get-acad-object)
) ;_ end of vla-get-activedocument
mdsp (vla-get-modelspace adoc)
) ;_ end of setq
;(setq lst nil); _for debug only
(setq pnm "ANSI31"
ptyp 0
bas :vlax-false
) ;_ end of setq
(setq htch (vla-addhatch mdsp 0 pnm bas))
(repeat 2
(vla-getentity (vla-get-utility adoc) 'obj 'pnt)
(vla-highlight obj :vlax-true)
(setq lst (cons (vlax-get obj 'startpoint)
(cons (vlax-get obj 'endpoint) lst)
) ;_ end of cons
) ;_ end of setq
) ;_ end of repeat

(setq pc (list (/ (apply '+ (mapcar 'car lst)) 4)
(/ (apply '+ (mapcar 'cadr lst)) 4)
(/ (apply '+ (mapcar 'caddr lst)) 4)
) ;_ end of list
) ;_ end of setq
(setq lst (vl-sort lst
(function (lambda (e1 e2)
(< (angle pc e1) (angle pc e2))
) ;_ end of lambda
) ;_ end of function
) ;_ end of vl-sort
) ;_ end of setq
(setq bndr (vla-addpolyline
mdsp
(vlax-safearray-fill
(vlax-make-safearray
vlax-vbdouble
(cons 0 (1- (length (apply 'append lst))))
) ;_ end of vlax-make-safearray
(apply 'append lst)
) ;_ end of vlax-safearray-fill
) ;_ end of vla-addpolyline
) ;_ end of setq
(vla-put-closed bndr :vlax-true)
(setq hobj (vlax-make-safearray vlax-vbobject '(0 . 0)))
(vla-appendouterloop
htch
(vlax-safearray-fill hobj (list bndr))
) ;_ end of vla-appendouterloop
(vla-put-patternscale htch 250.); _user scale
(vla-put-patternangle htch (* pi 0.125)); _user angle
(vla-evaluate htch)
(if (and (vlax-read-enabled-p bndr)
(vlax-write-enabled-p bndr)
) ;_ end of and
(vla-delete bndr)
) ;_ end of if
(if (vlax-object-released-p bndr)
(vlax-release-object bndr)
) ;_ end of if
(vla-regen adoc acactiveviewport)
(princ)
) ;_ end of defun

thank you
Message 13 of 13
Anonymous
in reply to: Anonymous

Dear sir

Please send this lisp for me

 

Regards

 

Pradeep

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost