KJB Posted October 5, 2010 Posted October 5, 2010 Is it possible to convert a SOLID to a hatch "solid"? Quote
ReMark Posted October 5, 2010 Posted October 5, 2010 I don't believe you can convert a solid to a hatch solid. Quote
marmo Posted October 5, 2010 Posted October 5, 2010 No, even if they have the same name are two distinctly different entities. Quote
KJB Posted October 5, 2010 Author Posted October 5, 2010 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. Quote
KJB Posted October 5, 2010 Author Posted October 5, 2010 (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 October 6, 2010 by KJB Quote
ReMark Posted October 5, 2010 Posted October 5, 2010 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 Quote
KJB Posted October 5, 2010 Author Posted October 5, 2010 Yeah, I was intimidated by the posts of the other forum. Quote
ReMark Posted October 5, 2010 Posted October 5, 2010 alanjt said: LoLThat was odd. I think we've been punked. Quote
Cad64 Posted October 5, 2010 Posted October 5, 2010 So what was the reason for this thread exactly? Quote
KJB Posted October 5, 2010 Author Posted October 5, 2010 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. Quote
Cad64 Posted October 5, 2010 Posted October 5, 2010 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. Quote
KJB Posted October 5, 2010 Author Posted October 5, 2010 LISP routine from Jeff Mishler found on CADForums.net via google "SOLID TO HATCH". Quote
alanjt Posted October 5, 2010 Posted October 5, 2010 KJB said: LISP routine from Jeff Mishler found on CADForums.net via google "SOLID TO HATCH". He meant tag the code with credits. Quote
marmo Posted October 6, 2010 Posted October 6, 2010 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:):) Quote
Recommended Posts
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.