Visual LISP, AutoLISP and General Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
"Hatch to back" reactor
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Does anyone have a reactor or something that ensures all hatch is "sent to back"?
If so, is there any chance of sharing please??
I know nothing of reactors. I do have a routine to send all hatch to back on demand, but would really like something that does it automatically.
Many thanks in advance
HOLLY Message was edited by: Holly
Attrocious spelling!
Re: "Hatch to back" reactor
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
options, one of which forces all new hatches to the back.
But of course if you are looking at changing existing hatches in existing
drawings... ignore the above!
Ian
Hi all!
Does anyone have a reactor or something that ensures all hatch is "sent to
back"?
If so, is there any chance of sharing please??
I know nothing of reactors. I do have a routine to send all hatch to back on
demand, but would really like something that does it automatically.
Many thanks in advance
HOLLY
Message was edited by: Holly
Attrocious spelling!
Re: "Hatch to back" reactor
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Wasn't aware of HPDRAWORDER - ansd so it seems neither is my version of AutoCAD!!! 2004.0.0
Copy of command line below:
--------------------------------------------------
Command: hpdraworder
Unknown command "HPDRAWORDER". Press F1 for help.
Command: setvar
Enter variable name or [?]
Unknown variable name. Type SETVAR ? for a list of variables.
--------------------------------------------------
Cheers,
HOLLY
Re: "Hatch to back" reactor
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
> on demand, but would really like something that does it automatically.
In real time or when you do a specific action ? In real time, on all hatchs
of a drawing, I'm septic that it's possible.
Bruno Toniutti
(sorry for my english level)
Re: "Hatch to back" reactor
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
; - Initialize ActiveX support
;(vl-load-com)
;
; - Reactors --------------------------------------------------
;
; - If not set, initialize DocManager-Reactor
(or Me:ReaDma
(setq Me:ReaDma (VLR-DocManager-Reactor
nil
'(
(:VLR-documentToBeDestroyed . MeDocToBeDestroyedCallbacks)
)
)
)
)
; - If not set, initialize Command-Reactor
(or Me:ReaCom
(setq Me:ReaCom (VLR-Command-Reactor
nil
'(
(:VLR-commandEnded . MeCommandEndedCallbacks)
)
)
)
)
;
; - Notifications --------------------------------------------------
;
; - CommandEnded notifications
(defun MeCommandEndedCallbacks (Rea Arg)
(MeDoCmdEndedStuff Arg)
(princ)
)
; - DocToBeDestroyed notifications
(defun MeDocToBeDestroyedCallbacks (Rea Arg)
(MeDoCloseStuff)
(princ)
)
;
; - Subs --------------------------------------------------
;
; - Command ended function
(defun MeDoCmdEndedStuff (Arg / CurCmd ObjNme TmpObj)
(setq CurCmd (strcase (car Arg)))
(cond
((vl-position CurCmd '("BHATCH" "HATCH" "IMAGEATTACH" "SOLID"))
(setq TmpObj (vlax-ename->vla-object (entlast))
ObjNme (vla-get-ObjectName TmpObj)
)
(if (vl-position ObjNme '("AcDbHatch" "AcDbRasterImage" "AcDbSolid"))
(MeSetDrawOrder (list TmpObj) nil 'MoveToBottom)
)
)
;;; other command ended dependent functions
)
(princ)
)
; - Reactor cleanup function
(defun MeDoCloseStuff ( / VarLst)
(setq VarLst (MeGetReaVars))
(mapcar 'VLR-remove (mapcar 'eval VarLst))
(mapcar '(lambda (l) (set l nil)) VarLst)
(princ)
)
; - Collect global reactor variables
(defun MeGetReaVars ( / RetVal)
(foreach memb (atoms-family 1)
(if (wcmatch (strcase memb) "ME:REA*")
(setq RetVal (cons memb RetVal))
)
)
(mapcar 'read RetVal)
)
; - Set object draw order
(defun MeSetDrawOrder (Obl Tob Mde / AcaDoc ExtDic SreTbl)
(setq AcaDoc (vla-get-ActiveDocument (vlax-get-acad-object))
ExtDic (vla-GetExtensionDictionary (vla-get-ModelSpace AcaDoc))
)
(if (vl-catch-all-error-p
(setq SreTbl (vl-catch-all-apply
'vla-Item (list ExtDic "ACAD_SORTENTS")
)
)
)
(setq SreTbl (vla-AddObject ExtDic "ACAD_SORTENTS" "AcDbSortentsTable"))
)
(cond
((vl-position Mde '(MoveToTop MoveToBottom))
(not (vlax-Invoke SreTbl Mde Obl))
)
(Tob
(not (vlax-Invoke SreTbl Mde Obl Tob))
)
)
)
; - Set hatch/image draw order on startup
(defun MeSendRasterAndImageToBottom ( / CurEnt CurSet ObjLst)
(if (setq CurSet (ssget "X" '((0 . "HATCH"))))
(progn
(while (setq CurEnt (ssname CurSet 0))
(setq ObjLst (cons (vlax-ename->vla-object CurEnt) ObjLst))
(ssdel CurEnt CurSet)
)
(MeSetDrawOrder ObjLst nil 'MoveToBottom)
)
)
(setq ObjLst '())
(if (setq CurSet (ssget "X" '((0 . "SOLID"))))
(progn
(while (setq CurEnt (ssname CurSet 0))
(setq ObjLst (cons (vlax-ename->vla-object CurEnt) ObjLst))
(ssdel CurEnt CurSet)
)
(MeSetDrawOrder ObjLst nil 'MoveToBottom)
)
)
(setq ObjLst '())
(if (setq CurSet (ssget "X" '((0 . "IMAGE"))))
(progn
(while (setq CurEnt (ssname CurSet 0))
(setq ObjLst (cons (vlax-ename->vla-object CurEnt) ObjLst))
(ssdel CurEnt CurSet)
)
(MeSetDrawOrder ObjLst nil 'MoveToBottom)
)
)
(princ)
)
;
; - Startup functions --------------------------------------------------
;
;(MeSendRasterAndImageToBottom)
;
; == Copyright - Note (May be never deleted) ==================================
;
; ©2005 MENZI ENGINEERING GmbH, Switzerland
; --------------------------------------------------
;
And here's a little something to force all hatch that isn't already, to the back.
(defun C:HATCHBACK ( / hss cmd)
(setq cmd (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq hss (ssget "X" (list (cons 0 "HATCH"))))
(command "_.draworder" "p" "" "back")
(setvar "cmdecho" 1)
(princ)
)
--
Matt W
"What the flip was Grandma doing at the sand dunes?"
Re: "Hatch to back" reactor
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
That works a dream!
I already had a lisp routine that moves all existing hatch to back, but this reactor thingy(!) does just what I want - puts hatch to back straight away when hatching.
Cheers guys, thanks for the help.
HOLLY
ps. I think you need to keep a closer eye on Grandma by the sounds of things!
Re: "Hatch to back" reactor
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
(defun C:HATCHBACK ( / hss cmd)
(setq cmd (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq hss (ssget "X" (list (cons 0 "HATCH"))))
(command "_.draworder" "p" "" "back")
(setvar "cmdecho" 1)
(princ)
)
It is possible to do this in model and paper space at the same time? Like in on shot?
Thanks!
Re: "Hatch to back" reactor
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
msarqui wrote:(defun C:HATCHBACK ( / hss cmd)
(setq cmd (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq hss (ssget "X" (list (cons 0 "HATCH"))))
(command "_.draworder" "p" "" "back")
(setvar "cmdecho" 1)
(princ)
)
It is possible to do this in model and paper space at the same time? Like in on shot?....
Commands that use object selection, even when used in AutoLISP (command) functions, only "see" objects in the current space. I looked for something in objects' entity data or VLA Properties or extended data that changed when I sent them to the back, but I didn't find anything, so I'm not sure what it does to them that might be done by way of (entmod) or (vla-put...) or something, so that you could do it even to things not in the current space.
If there isn't a way like that, you can always resort to changing the space you're in to do each one [untested]:
(defun C:HATCHBACK (/ cmd curtab)
(setq
cmd (getvar 'cmdecho)
curtab (getvar 'ctab); save starting space
); setq
(setvar 'cmdecho 0)
(foreach h (mapcar 'cadr (ssnamex (ssget "_X" '((0 . "HATCH")))))
; list of Hatch entity names
(setvar 'ctab (cdr (assoc 410 (entget h)))); move to its space
(command "_.draworder" h "" "back")
); foreach
(setvar 'cmdecho 1)
(setvar 'ctab curtab); restore starting space
(princ)
)
Re: "Hatch to back" reactor
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks for the reply Kent.
It is not working. My AutoCAD stops...
Re: "Hatch to back" reactor
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
msarqui wrote:Thanks for the reply Kent.
It is not working. My AutoCAD stops...
It works for me, though in very limited testing. Try commenting out the turning off of the CMDECHO System Variable, and see whether you can tell what's not working. Also, I'm still way back in 2004 -- if you're not, might the command prompt sequence have changed in a newer version?


