Jump to content

Recommended Posts

Posted

Is it possible to convert a SOLID to a hatch "solid"?

Posted

I don't believe you can convert a solid to a hatch solid.

Posted

No, even if they have the same name are two distinctly different entities.

Posted

Earlier I googled "SOLID TO HATCH" and came across a LSP on different forum.

I thought I give this site before I got too involved with LISP.

Posted (edited)

Piece of cake. Here are the two LSP files required to convert a SOLID to a hatch "solid". No modification was required on my part.

 

LISP routine from Jeff Mishler found on CADForums.net

 

(defun get_space ()

(if (= (getvar "cvport") 1)

(vla-get-paperspace (vla-get-activedocument (vlax-get-acad-object)))

(vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))

)

)

 

(defun convert2dsolids (/ 2dcoords coords count hatch obj pline space ss)

(and (setq ss (ssget '((0 . "SOLID"))))

(setq count -1)

(setq space (get_space))

(while (

(setq obj (vlax-ename->vla-object (ssname ss count)))

(setq coords (vlax-get obj 'coordinates))

(setq 2dcoords (list (car coords)(cadr coords)))

(setq coords (cdr (cdr (cdr coords))))

(setq 2dcoords (append 2dcoords (list (car coords)(cadr coords))))

(setq coords (cdr (reverse (cdr (cdr (cdr coords))))))

(setq 2dcoords (append 2dcoords (list (cadr coords)(car coords))))

(setq coords (reverse coords))

(setq 2dcoords (append 2dcoords (list (car coords)(cadr coords))))

(setq pline (vlax-invoke space 'addlightweightpolyline 2dcoords))

(vla-put-closed pline :vlax-true)

(setq hatch (vlax-invoke space 'addhatch acHatchPatternTypePredefined

"SOLID" :vlax-true))

(vlax-invoke hatch 'appendouterloop (list pline))

(vla-put-color pline (vla-get-color obj))

(vla-put-color hatch (vla-get-color obj))

(vla-put-layer pline (vla-get-layer obj))

(vla-put-layer hatch (vla-get-layer obj))

(vla-delete obj)

)

)

)

(defun c:cd ()

(convert2dsolids)

(princ)

)

Edited by KJB
Posted

So you asked the question already knowing not only what the answer would be but how to solve the puzzle too?

 

You are one devious bassturd. No offense meant. LOL

Posted

Yeah, I was intimidated by the posts of the other forum. :whistle:

Posted
  alanjt said:
LoL

That was odd.

 

I think we've been punked.

Posted

Like I said before I was intimidated by the posts of the other forum and instead of just copy the lisps file and see what happens.

I started a post here because I have a lot more respect for you guys.

Posted

Ok, so who wrote the lisp routine that you posted? Did you write it? If so, then you should add a header with your name and info.

If someone else wrote it, then you should give credit to the author.

Posted

LISP routine from Jeff Mishler found on CADForums.net via google "SOLID TO HATCH".

Posted
  KJB said:
LISP routine from Jeff Mishler found on CADForums.net via google "SOLID TO HATCH".

facepalm.gif He meant tag the code with credits.

Posted

Thank you for your lisp! It 's very useful!!!

Although in this case the solid is not converted "spontaneously" ... is kicked and it says "becomes a hatch!"

I do not know very well the language lisp, but this really seems to me the time of its shooting. Perhaps because it has resisted ...

...

(vla-delete obj)

...

 

Hi,

Marco:):):)

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...