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