custom hatch

custom hatch

waseemtarik
Advocate Advocate
966 Views
7 Replies
Message 1 of 8

custom hatch

waseemtarik
Advocate
Advocate

first of all, I would like to thank all of you for helping us to get a better and faster way for drawings. 

I'm working in one of the big projects, and I need the hatch to be custom as required, I have tried to stretch the hatch in dynamic block, but it didn't work for me. if you could please can have a stretch hatch or a custom hatch so I dont need to copy paste each time to redraw the hatch with it's pattern for each boundary, please see attache and let me know if there's an easiest way for it.

please note that hatch colour and pattern has to be the same

thanks, 

waseem  

0 Likes
967 Views
7 Replies
Replies (7)
Message 2 of 8

Sea-Haven
Mentor
Mentor

I have stagger array so you could take the slot array it then use extrim etc trim to outside shape hatch inside, hatch gaps. 

; https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/rectangular-array-creating-every-other-row-offset/td-p/9667120
; array rows a 1/2 x spacings
; Enter -ve values to change direction.
;By AlanH info@alanh.com.au Aug 2020

(defun c:zigzag ( / ent ss ans hor ver numx numy x )
(setq ent (entsel "\nSelect object to array"))
(setq ss (ssadd))
(ssadd (car ent) ss)
(if (not AH:getvalsm)(load "Multi Getvals.lsp"))
(setq ans (AH:getvalsm (list "Enter spacings " "Horizontal  " 5 4 "100" "Vertical" 5 4 "50" "Num X " 5 4 "3"  "Num Y" 5 4 "3")))
(setq hor (atof (nth 0 ans)))
(setq ver (atof (nth 1 ans)))
(setq numx (atoi (nth 2 ans)))
(setq numy (atoi (nth 3 ans)))
(setq x 1.0)
(repeat (- numx 1)
(command "copy" ent "" (list 0.0 0.0) (list  (* x hor) 0.0) )
(ssadd (entlast) ss)
(setq x (+ x 1))
)
(setq x 1.0)
(while (< x numy)
(command "copy" ss "" (list 0.0 0.0) (list (* 0.5 (- hor)) (* x ver)))
(setq x (+ x 2))
)
(setq x 2.0)
(while (< x numy)
(command "copy" ss "" (list 0.0 0.0) (list 0.0 (* ver x)))
(setq x (+ x 2))
)
(princ)
)
(c:zigzag)

0 Likes
Message 3 of 8

waseemtarik
Advocate
Advocate

@Sea-Haven lisp doesn't work please explain how to use it 

thanks 

0 Likes
Message 4 of 8

Sea-Haven
Mentor
Mentor

Sorry needs a library "Multi getvals.lsp" this is a library function can be used in any code for multiple inputs. Just save in a supported path. It can have 1 or as many as screen size allows inputs. Just select 1 slot.

 

screenshot248.png

 

 

 

 

0 Likes
Message 5 of 8

waseemtarik
Advocate
Advocate

@Sea-Haven is there a way of making a short video or GIF pictures as I don't understand what is that and the way of using it. thanks 

0 Likes
Message 6 of 8

Sea-Haven
Mentor
Mentor

It just takes 1 object say the slot you just pick the slot, the dcl will pop up and you answer the spacing and how many required it is a guess sometimes. Better to do to many than not enough, then do normal trim excess, hatch the slots grey then hatch say exterior boundary pline and draworder send to back.

 

You need to save the two programs in same directory, you should save all your downloaded programs into a supported directory that means Autocad can find them. If you dont know how to do this post. You can use Appload and pick the two programs the Multi getvals 1st then Zigzag or you can use explorer, drag and drop files onto Autocad. 

 

screenshot249.png

0 Likes
Message 7 of 8

CADaSchtroumpf
Advisor
Advisor

I don't have a hatch, but to make punched rails I use some type of line, maybe you could use that.

It is based on this model:

punched rail.gif
Copy and paste directly into a drawing and you will have the type of line available.

It is for a linetype scale of 1 for units in meter

((lambda ( / f_shp f_lin doc)
	(if (not (findfile "SLOT.shp"))
		(progn
			(setq f_shp (open (strcat (getvar "ROAMABLEROOTPREFIX") "support\\SLOT.shp") "w"))
			(write-line "*250,34,SLOT" f_shp)
			(write-line "002,003,100,003,10,0F4,0B4,001,008,(-99,0),0A,26,024,008,(99,0),008,(99,0),0A,26,064,008,(-99,0),002,0FC,0BC,004,100,004,10,0" f_shp)
			(close f_shp)
		)
	)
	(command "_.compile" (strcat (getvar "ROAMABLEROOTPREFIX") "support\\SLOT.shp"))
	(if (not (tblsearch "STYLE" ""))
		(entmakex
			'(
				(0 . "STYLE")
				(100 . "AcDbSymbolTableRecord")
				(100 . "AcDbTextStyleTableRecord")
				(2 . "")
				(70 . 1)
				(40 . 0.0)
				(41 . 1.0)
				(50 . 0.0)
				(71 . 0)
				(42 . 2.5)
				(3 . "SLOT.shx")
				(4 . "")
			 )
		)
	)
	(entmake
		(list
			'(0 . "LTYPE")
			'(100 . "AcDbSymbolTableRecord")
			'(100 . "AcDbLinetypeTableRecord")
			'(2 . "PUNCHED-RAIL")
			'(70 . 0)
			'(3 . "| - - - - - |")
			'(72 . 65)
			'(73 . 4)
			'(40 . 0.36)
			'(49 . 0.0)
			'(74 . 0)
			'(49 . -0.18)
			'(74 . 12)
			'(75 . 250)
			(CONS 340 (TBLOBJNAME "STYLE" ""))
			'(46 . 1.0)
			'(50 . 0.0)
			'(44 . 0.0)
			'(45 . 0.0)
			'(49 . -0.18)
			'(74 . 0)
			'(49 . 0.0)
			'(74 . 0)
		)
	)
	(if (not (findfile "PUNCHED-RAIL.lin"))
		(progn
			(setq f_lin (open (strcat (getvar "ROAMABLEROOTPREFIX") "support\\PUNCHED-RAIL.lin") "w"))
			(write-line "*PUNCHED-RAIL,| - - - - - |" f_lin)
			(write-line "A,0,-0.18,[SLOT,SLOT.shx,U=0,S=1,X=0,Y=0],-0.18,0" f_lin)
			(close f_lin)
		)
	)
	(setq doc (vla-get-activedocument (vlax-get-acad-object)))
	(if
		(and
			(not
				(vlax-for item (vla-get-linetypes doc)
					(if (= (strcase (vla-get-name item)) (strcase "PUNCHED-RAIL")) T)
				)
			)
			(vl-catch-all-error-p
				(vl-catch-all-apply
					'vla-load
					(list (vla-get-Linetypes doc) "PUNCHED-RAIL" "PUNCHED-RAIL.lin")
				)
			)
		)
		nil
		T
	)
	(princ "\nTypeLine \"PUNCHED-RAIL\" has created")
	(prin1)
))

 

0 Likes
Message 8 of 8

Sea-Haven
Mentor
Mentor

Nice idea only problem is that slot is hatched can not do that with linetype. The request is for a pattern of slots.

0 Likes