Jump to content

Entmake of a circular hatch


Recommended Posts

Posted

Hi all:

 

I'm currently trying to entmakex a circular hatch for a block. I tried to follow the dxf guid provided by autocad but my entmake is returning nil, so I'm doing something wrong somewhere. I copied the DXF from a hatch i made using the hatch dialog and tried to use that as a template. I've also looked into the ElpanovEvgeniy hatch maker routine. My understanding is that only does rectangular hatches though. Below is my current entmakex description. 

      (setq fill (entmakex (list (cons 0 "HATCH")
				 (cons 100 "AcDbEntity")
				 (cons 410 "Model")
				 (cons 8 "TS_SLOPES")
				 (cons 100 "AcDbHatch")
				 (cons 10 (list 0.0 0.0 0.0))
				 (cons 210 (list 0.0 0.0 1.0))
				 (cons 2 "SOLID")
				 (cons 70 1)
				 (cons 71 1)
				 (cons 91 1)
				 (cons 92 7)
				 (cons 72 2)
				 (cons 73 1)
				 (cons 93 2)				 
				 (cons 10 (list (/ w 2) (/ h 2) 0.0))
				 (cons 40 (* (/ h 2) 0.8))
				 (cons 50 0)
				 (cons 51 360)
				 (cons 73 0)
				 (cons 97 1)
				 (cons 330 (cdr (assoc -1 (entget (entlast)))))
				 (cons 75 0)
				 (cons 76 1)
				 (cons 45 4.58386)
				 (cons 98 1)
				 (cons 10 (list (/ w 2) (/ h 2) 0.0))
				 (cons 450 0)
				 (cons 451 0)
				 (cons 452 0)
				 (cons 453 0)
				 (cons 460 0.0)
				 (cons 461 0.0)
				 (cons 462 1.0)
				 (cons 463 0)
				 (cons 470 "LINEAR")))

	    )

Can anyone point me in the right direction? I'm pretty stuck. 

 

Thanks in advance,

Brandon

Posted

Based on THIS post, see if this works.

(defun c:foo (/ d p)
  (while
    (and (setq p (getpoint "\nPick center point:")) (or d (setq d (getdist p "\nPick radius: "))))
     (entmakex (list '(0 . "HATCH")
		     '(100 . "AcDbEntity")
		     '(8 . "hatch")
		     '(100 . "AcDbHatch")
		     '(10 0. 0. 0.)
		     '(210 0. 0. 1.)
		     '(2 . "SOLID")
		     '(70 . 1)
		     '(71 . 0)
		     '(91 . 1)
		     '(92 . 1)
		     '(93 . 1)
		     '(72 . 2)
		     (cons 10 p)
		     (cons 40 (/ d 2))
		     '(50 . 0.)
		     (cons 51 (* 2 pi))
		     '(73 . 1)
		     '(97 . 0)
		     '(75 . 1)
		     '(76 . 1)
		     '(98 . 1)
		     '(10 0. 0. 0.)
		     '(450 . 0)
		     '(451 . 0)
		     '(460 . 0.)
		     '(461 . 0.)
		     '(452 . 0)
		     '(462 . 0.)
		     '(453 . 2)
		     '(463 . 0.)
		     '(63 . 5)
		     '(421 . 255)
		     '(463 . 1.)
		     '(63 . 2)
		     '(421 . 16776960)
		     '(470 . "LINEAR")
	       )
     )
  )
  (princ)
)

 

Posted
40 minutes ago, brandalf_the_semiGray said:

(cons 51 360)

This is one of the errors above. Need to be radians (* 2 pi)

Posted
15 minutes ago, ronjonp said:

Based on THIS post, see if this works.


(defun c:foo (/ d p)
  (while
    (and (setq p (getpoint "\nPick center point:")) (or d (setq d (getdist p "\nPick radius: "))))
     (entmakex (list '(0 . "HATCH")
		     '(100 . "AcDbEntity")
		     '(8 . "hatch")
		     '(100 . "AcDbHatch")
		     '(10 0. 0. 0.)
		     '(210 0. 0. 1.)
		     '(2 . "SOLID")
		     '(70 . 1)
		     '(71 . 0)
		     '(91 . 1)
		     '(92 . 1)
		     '(93 . 1)
		     '(72 . 2)
		     (cons 10 p)
		     (cons 40 (/ d 2))
		     '(50 . 0.)
		     (cons 51 (* 2 pi))
		     '(73 . 1)
		     '(97 . 0)
		     '(75 . 1)
		     '(76 . 1)
		     '(98 . 1)
		     '(10 0. 0. 0.)
		     '(450 . 0)
		     '(451 . 0)
		     '(460 . 0.)
		     '(461 . 0.)
		     '(452 . 0)
		     '(462 . 0.)
		     '(453 . 2)
		     '(463 . 0.)
		     '(63 . 5)
		     '(421 . 255)
		     '(463 . 1.)
		     '(63 . 2)
		     '(421 . 16776960)
		     '(470 . "LINEAR")
	       )
     )
  )
  (princ)
)

 

there it is! thank you so much. It appears that I was on the right track.

 

Quick question... when referencing the DXF guide in autocad documentation, should the dxf codes always go in the order the guide presents them (top to bottom)?

Posted
16 minutes ago, brandalf_the_semiGray said:

Quick question... when referencing the DXF guide in autocad documentation, should the dxf codes always go in the order the guide presents them (top to bottom)?

Which guide are you referring to? I mostly use a slightly modified version of THIS when 'entmaking'.

 

I'd imagine the order is somewhat important. I know specifically when 'entmodding'.

(if (setq e (car (entsel)))
  (entmod (append (entget e) '((8 . "NewLayer"))))
)

 

Posted
2 minutes ago, ronjonp said:

Which guide are you referring to? I mostly use a slightly modified version of THIS when 'entmaking'.

 

I'd imagine the order is somewhat important. I know specifically when 'entmodding'.


(if (setq e (car (entsel)))
  (entmod (append (entget e) '((8 . "NewLayer"))))
)

 

Do i need an account on the swamp to view that? says its off limits to me or missing. 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...