blatz.boy Posted May 17, 2011 Share Posted May 17, 2011 I'm basically trying to create a hatch within a hatch. I have a grid created with ANSI 137, and I'm trying to create a series of solid fill squares withing this grid, but the existing grid/hatch is not being recognized as a boundary at all. I seem to remember having done this in the past without incident, but have recently upgraded to 2012. To get the job off my desk, I'm just exploding the hatch for the moment, but I hate doing this. Any suggestions? Thanks. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 17, 2011 Share Posted May 17, 2011 I *beleive* this requires that a copy of the ANSI 137 hatch be copied to a construction / temporary layer, then exploded, then place your new solid fill hatches, then LAYDEL the construction / temporary layer. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 17, 2011 Share Posted May 17, 2011 (edited) I'm sure there are better ways of doing this (I just don't have time at the moment), but this should provide you a solid start.... Example: (defun c:HIH () (c:HatchInsideHatch)) (defun c:HatchInsideHatch (/ *error* *exit* ss eName oHatchOld activeDoc oldQaflags oldCmdecho oldNomutt layerName) ;; © RenderMan 2011, CADTutor.net (princ "\rHATCH INSIDE HATCH ") (vl-load-com) (defun *error* (msg) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** ")))) ; Fatal error, display it (*exit*)) (defun *exit* () (if (and layerName (setq ss (ssget "_x" (list (cons 8 layername))))) (progn (vlax-for x (setq ss (vla-get-activeselectionset activeDoc)) (vla-delete x)) (vla-delete ss) (vla-delete (vla-item (vla-get-layers activeDoc) layerName)))) (and oldNomutt (setvar 'nomutt oldNomutt)) (and oldCmdecho (setvar 'cmdecho oldCmdecho)) (and oldQaflags (setvar 'qaflags oldQaflags)) (vla-endundomark activeDoc) (princ)) (vla-startundomark (setq activeDoc (vla-get-activedocument (vlax-get-acad-object)))) (terpri) (prompt "\nSelect hatch: ") (if (and (and (setq oldQaflags (getvar 'qaflags)) (setvar 'qaflags 1)) (and (setq oldCmdecho (getvar 'cmdecho)) (setvar 'cmdecho 0)) (and (setq oldNomutt (getvar 'nomutt)) (setvar 'nomutt 1)) (setq ss (ssget "_:L:S:E" '((0 . "HATCH")))) (/= "SOLID" (cdr (assoc 2 (entget (setq eName (ssname ss 0)))))) (setq oHatchOld (vlax-ename->vla-object eName))) (progn (vl-cmdf "._-layer" "new" (setq layerName "Z_HatchInHatch") "color" (vla-get-color (vla-item (vla-get-layers activeDoc) (vla-get-layer oHatchOld))) layerName "") (vla-put-layer (vla-copy oHatchOld) layerName) (vl-cmdf "._explode" (entlast) "") (setvar 'nomutt 0) (prompt "\nPick internal points: ") (vl-cmdf "._-hatch" "properties" "solid") (while (< 0 (getvar 'cmdactive)) (command pause))) (progn (setvar 'nomutt 0) (cond (ss (prompt "\n** Solid hatch pattern not allowed ** ")) ((prompt "\n** Nothing selected ** "))))) (*exit*)) Note - Resultant hatch objects are created on the current layer. @ Moderator - Would you move this thread to the LISP forum, please? Edited May 18, 2011 by BlackBox Code update - Solid hatch check Quote Link to comment Share on other sites More sharing options...
BIGAL Posted May 18, 2011 Share Posted May 18, 2011 If you just want a boundary search for hatchb.lsp it makes a new pline boundary. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 18, 2011 Share Posted May 18, 2011 If you just want a boundary search for hatchb.lsp it makes a new pline boundary. I'd be very disappointed if that is all the OP is after. I (mis?)understood the OP to be asking for how to use the line work of the selected hatch as a boundary for subsequent hatch creation (hence the code I posted). Quote Link to comment Share on other sites More sharing options...
SLW210 Posted May 18, 2011 Share Posted May 18, 2011 I'd be very disappointed if that is all the OP is after. I (mis?)understood the OP to be asking for how to use the line work of the selected hatch as a boundary for subsequent hatch creation (hence the code I posted). That's they way I understood it. That code looks good, I will give it a try later on today. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted May 18, 2011 Share Posted May 18, 2011 That's they way I understood it. That code looks good, I will give it a try later on today. It worked well for testing the ANSI 137 hatch the OP specified. Not sure why it would work with other hatch patterns, except for Solid (ohhh, I should add a check for that! ) Edit - Code updated above. I recorded a demo using SnagIt, but sadly that only allows me to save as .AVI - Not sure how to convert to .GIF to post with the (lack of) software installed on my laptop. Quote Link to comment Share on other sites More sharing options...
SLW210 Posted May 18, 2011 Share Posted May 18, 2011 I have the updated version and have moved the thread to the LISP forum. 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.