Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

A2K4 Freeze/Hide Hatches 1

Status
Not open for further replies.

cparnell

Mechanical
Sep 23, 2002
71
In order to freeze properly, we assign hatches to the layer of the object they are representing. Such as HONEY hatch we use on our TUB layer. ANSI37 to our EXCEL-KOMACEL or CELTEC layer. We need to be able to view EXCEL-KOMACEL layer with its hatch when TUB layer and its hatch is frozen in order to be able to STRETCH or modify in other ways. When a hatch is selected the LIST command and properties dialog box, references it as a hatch. Is there a way to have a LISP routine toggle on/off to freeze/hide hatch entities them-selves rather than the object that is being hatch? I realize that we could create a separate layer called, “EXCEL-KOMACEL Hatch” or “TUB Hatch”, to be able to freeze just that hatch, but it would be nice to be able to have a routine to freeze/hide all hatches. Actually the main reason that we would like to do this is when we try to DIMENSION an object that is hatched, inevitably we will accidentally choose the end point of a hatch rather the end point of the rectangle that we are trying to hatch. WHICH IS FRUSTRATING!! Thanks in advance for any help!! By the way this new Associative Dimension is COOL

Charles S. Parnell
Southern Store Fixtures
 
Replies continue below

Recommended for you

If I understand it right you want to toggle the hatches off ... like you can with "FILLS" in Fonts & plines.

[sadeyes] I don't believe this is possible with hatches, because are esentailly ALL LINES. Hatches don't have any special properities to distiughish them ... I think? [neutral]

I hope some here has a speical lisp for ya' ... BUT I think ... in order for this to happen "You will need to separate the hatches on to SEPARATE LAYERS" ... sorry guy.
 
I guess that Toggle would have been a better description.
I was afraid that it may not work.


Charles S. Parnell
Southern Store Fixtures
 
Hi Charles,

I found a lisp called "Noshow", which can toggle off selected objects (not automatically hatches). The layers still on and thawed...
toggle off: "NSH"
on:"SSH" DON'T FORGET TO TOGGLE ON

Maybe someone can edit the lisp for You...
Lisp was found:
Lothar





;****************************************************************************************************
;
;Hinweis:
;bitte denkt dran, wenn Ihr eine Zeichnung an andere weitergebt, sollten alle Elemente sichtbar sein.
;Es wissen die wenigsten User, wie sie 'unsichtbare' Elemente wieder sichtbar machen können.
;
;*****************************************************************************************************

;********************** Beginn Befehle **************************
; NSH schaltet alle gewählten Elemente aus (Noshow)

(defun C:NSH (/ a)

(princ "\nZum Ausschalten")
(setq a (ssget)) ; sichtbare wählen
(if a
(noshow a) ; ausschalten
(princ "\nKeine Elemente gewählt\n")
) ;_ end of if
(princ)
) ;_ end of defun

; SSH schaltet die gewählten Elemente wieder ein (Switch to show)
; Achtung: nach (grclear) können auch Elemente gefunden werden, die momentan unsichtbar sind,
; sich aber trotzdem schon im eingeschalteten Zustand befinden. Durch diese Auswahl
; wird aber ihr Zustand nicht verändert!

(defun C:SSH (/ a b)
(setq
a (ssget "X" (list (cons 60 1))) ; Alle ausgeschalteteten aus der Datenbank holen
) ;_ end of setq
(if a
(progn
(grclear) ; alle sichtbaren löschen
(show a) ; alle unsichtbaren zeigen
(princ "\nZur Sichtbarkeit")
(setq b (ssget)) ; gewünschte wählen
(if b ; falls welche gewählt
(progn
(noshow (sssub a b)) ; von den bisher unsichtbaren die gewählten herausnehmen
(show b) ; und die gewählten wieder sichtbar machen
) ;_ end of progn
(noshow a) ; wenn keine gewählt, wieder alle Unsichtbaren zurück
) ;_ end of if
) ;_ end of progn
(princ "\nKeine Elemente unsichtbar geschaltet\n")
) ;_ end of if
(redraw) ; Bildschirm wieder herstellen
(princ)
) ;_ end of defun

; TNSH schaltet alle unsichtbaren Elemente wieder sichtbat (toggle all noshow entities to show)

(defun C:TNSH (/ a)

(setq
a (ssget "X" (list (cons 60 1))) ; alle unsichtbaren in der Datenbank suchen
) ;_ end of setq
(if a ; falls welche gefunden
(show a) ; diese anzeigen
(princ "\nKeine Elemente unsichtbar geschaltet\n")
) ;_ end of if
(princ)
) ;_ end of defun

;********************** Ende Befehle **************************

;**********************Beginn Funktionen ****************************

; sssub subtrahiert von Auswahlsatz a Entities die in Auswahlsatz b enthalten sind

(defun sssub (a b / c d e)
(setq d 0.0) ; Realzahl als Indexzeiger für Auswahlsatz verwenden
(while (setq e (ssname b d))
(if (ssmemb e a)
(setq a (ssdel e a))
) ;_ end of if
(setq d (1+ d))
) ;_ end of while
a
) ;_ end of defun


; noshow schaltet die Entities in Auswahlsatz a unsichtbar

(defun noshow (a / b c d e)
(setq
b (sslength a)
c 0.0
) ;_ end of setq
(while (setq d (ssname a c))
(setq
e (entget d)

; Hier muß zum ersten Mal auf die Reihenfolge der Unterlisten in der Elementliste geachtet werden:
; e (append (list (cons 60 1)) e) würde mit R13 Entities nicht funktionieren !

e (append e (list (cons 60 1)))
) ;_ end of setq
(entmod e)
(setq c (1+ c))
) ; Ende while
) ;_ end of defun


; show schaltet die Entities in Auswahlsatz a sichtbar

(defun show (a / b c d e)
(setq
b (sslength a)
c 0.0
) ;_ end of setq
(while (setq d (ssname a c))
(setq
e (entget d)
e (subst (cons 60 0) (assoc 60 e) e)
; Hier gilt für die Reihenfolge das Gleiche wie bei noshow
) ;_ end of setq
(entmod e)
(redraw (cdr (assoc -1 e)) 3)
(setq c (1+ c))
) ; Ende while
) ;_ end of defun


; fld gibt die zu a assozierte Unterliste aus Liste b zurück

(defun fld (a b)
(cdr (assoc a b))
) ;_ end of defun

;**********************Ende Funktionen ****************************




Win NT4.0(SP6),2000(SP3)
AC 2000i(SP2), ADT 3.0(SP3),
AC 2002, ADT 3.3,
AC 2004, ADT 2004
 
exit
Thanks for your help.
However I was unable to get the NSH or the SSH to work. I got "Unknown command "NSH"". I restarted AutoCAD 2004 to see if that would help. It did not.

Thanks again for your help.

Any one else have any ideas?

Charles S. Parnell
Southern Store Fixtures
 
All this huge program really does is to change the group 60 from 0 to 1 to toggle visibility of the selected entities.

Here is my version. Save each one separately. HI makes hatches invisible, HV makes them all visible.

They are simple enough so you should be able to modify them to do what you need.

This one makes all hatches Invisible:

(defun c:HI (/ a b c d e)
(setq
a (ssget "x" (list (cons 0 "hatch"))) ; select all hatches
b (sslength a)
c 0.0
) ;_ end of setq
(while (setq d (ssname a c))
(setq
e (entget d)
e (append e (list (cons 60 1))) ; change the group 60
) ; end of setq
(entmod e)
(setq c (1+ c))
); end while
) ; end of function

This one makes all hatches Visible

(defun c:HV (/ a b c d e)
(setq
a (ssget "x" (list (cons 0 "hatch"))) ; select all hatches
b (sslength a)
c 0.0
) ;_ end of setq
(while (setq d (ssname a c))
(setq
e (entget d)
e (append e (list (cons 60 0))) ; change the group 60
) ; end of setq
(entmod e)
(setq c (1+ c))
); end while
) ; end of function

Good luck, my programming skills are pretty low on the scale!!
 
Hi IFRs, [thumbsup2]

thanks, Your tools works great. Can You put it in one Lisp?
if hatch on ->toggle off
if hatch off ->toggle on

@Cahrles use the command "_apppload"

Lothar

Win NT4.0(SP6),2000(SP3)
AC 2000i(SP2), ADT 3.0(SP3),
AC 2002, ADT 3.3,
AC 2004, ADT 2004
 
I guess you could use this:
This time the function is called with "ht".

; Toggles the visibility of all hatch entities

(defun c:HT ( / a b c d e)
(setq
a (ssget "x" (list (cons 0 "hatch"))) ; select all hatches
b (sslength a)
c 0.0
ht (IF ( = ht 0 ) 1 0)
) ;_ end of setq
(while (setq d (ssname a c))
(setq
e (entget d)
e (append e (list (cons 60 ht))) ; change the group 60
) ; end of setq
(entmod e) ; modify the entities
(setq c (1+ c))
); end while
) ; end of function

Add it to your Acad.Lsp file if you want to make it available all the time. Or you can load it with appload or by typing (load"ht").

It is a quick and dirty program - you have to run it twice at first to get the variable ht initialized because all variables are initially nil rather than zero. After that it works just fine (I think).

Good luck!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor