Visible-Invisible

Discussion in 'AutoCAD' started by ...megan, Jan 20, 2005.

  1. ...megan

    ...megan Guest

    Hi group...As my first time on the site, I want to introduce my self... I'm working for a large compagny here in Montreal (Canada,Quebec). We are approx. 60 drafters. My problem is very easy. If you are not one of the group (taking about the CAD manager), when you have some problem, wants to give comments on function they create...etc, you are just push aside. So in the last 3 month, with the Help file of Autocad + this site, I start learning Lisp and VLisps. I think I'm not bad at all now. I've created some function for my self and for some co-workers to....
    Now I want to attack something bigger... I want to modify a program we use here. It's call blank. To put object invisible than visible (code dxf 60). I would like to be able to select the object I want visible again.
    First, I select the objects that become invisible (blank). Than, when I run the visible command (unblank). There, I can choose btw ALL objects or SELECT objects. If I choose select, a selection set of the invisible object appears on screen (highlight) and a select the one I want to turn back visible.
    Is this to big??? Should I let this go and keep learning before???
    Any comment would be greatly appreciate!

    Megan
     
    ...megan, Jan 20, 2005
    #1
  2. ...megan

    T.Willey Guest

    See if this works for you. It only allows for single select for the unblanking method. I did it that way to make it clear which ones you are selecting.

    Tim

    (defun c:UnBlank2 (/ ss ss2 cnt1 tmpEnt tmpData ocmd)

    (setq ocmd (getvar "cmdecho"))
    (setvar "cmdecho" 0)
    (command "_.undo" "_end")
    (command "_.undo" "_group")
    (if (setq ss (ssget "x" (list '(60 . 1) (cons 410 (getvar "ctab")))))
    (progn
    (setq cnt1 0)
    (while (setq tmpEnt (ssname ss cnt1))
    (setq tmpData (entget tmpEnt))
    (entmod (subst (cons 60 0) (assoc 60 tmpData) tmpData))
    (redraw tmpEnt 3)
    (setq cnt1 (1+ cnt1))
    )
    (setvar "errno" 0)
    (while (/= (getvar "errno") 52)
    (and
    (setq tmpEnt (entsel "\n Select object to unblank \(Enter to quit\): "))
    (ssdel (car tmpEnt) ss)
    (setq tmpData (entget (car tmpEnt)))
    (entmod (subst (cons 60 1) (assoc 60 tmpData) tmpData))
    )
    )
    (if (/= (sslength ss) 0)
    (progn
    (setq cnt1 0)
    (while (setq tmpEnt (ssname ss cnt1))
    (setq tmpData (entget tmpEnt))
    (if (assoc 60 tmpData)
    (entmod (subst (cons 60 1) (assoc 60 tmpData) tmpData))
    (entmod (append tmpData (list (cons 60 1))))
    )
    (setq cnt1 (1+ cnt1))
    )
    )
    )
    )
    (prompt "\n Nothing blanked in current tab. ")
    )
    (command "_.undo" "_end")
    (setvar "cmdecho" ocmd)
    (princ)
    )
     
    T.Willey, Jan 20, 2005
    #2
  3. ...megan

    ...megan Guest

    WOW....

    Thank you Tim. I can't beleive it.
    I'm happy that I was on the right way with the code 60...

    Thanks again Tim

    Megan
     
    ...megan, Jan 20, 2005
    #3
  4. ...megan

    T.Willey Guest

    Happy to help. I hope you can decipher it. If you have any questions about it, post and I will try and answer.

    I never knew you could blank stuff until you posted, so Thank you Megan.

    Tim
     
    T.Willey, Jan 20, 2005
    #4
  5. ...megan

    mataeux Guest

    here's our contribution.
    this single function toggles the visibility of objects and allows any
    selection method.
    to quickly toggle dxf code 60 is a great help.
    we use it mostly to hide hatch boundaries.
    its like sending objects to an invisible layer.


    (defun c:vi(/ *error* ss ss2 ent elist ct)
    (defun *error*(s)
    (setq ct 0)
    (repeat(sslength ss)
    (setq ent(ssname ss ct)elist(entget ent)ct(1+ ct))
    (entmod(append elist'((60 . 1))))
    )
    (sssetfirst ss ss)
    (command "._undo" "END")
    (princ)
    )
    (command "._undo" "BEGIN")
    (setq ss (cond((ssget "X"'((60 . 1))))((ssadd)))ct 0)
    (repeat(sslength ss)
    (setq ent(ssname ss ct)elist(entget ent)ct(1+ ct))
    (entmod(subst'(60 . 0)'(60 . 1)elist))
    )
    (princ)
    (while
    (progn
    (foreach v(reverse(vports))(setvar "CVPORT" (car v))
    (setq ct 0)(repeat(sslength ss)(redraw(ssname ss ct)3)(setq ct(1+ ct)))
    )
    (prompt(strcat "\n"(itoa(sslength ss))" Invisible Object"(if(=(sslength
    ss)1)" is""s are")" highlighted."))
    (setq ss2(ssget ":S"))
    )
    (setq ct 0)
    (repeat(sslength ss2)
    (setq ent(ssname ss2 ct)ct(1+ ct))
    (if(ssmemb ent ss)(progn(ssdel ent ss)(redraw ent 4))(ssadd ent ss))
    )
    )
    (*error*())
    )
     
    mataeux, Jan 20, 2005
    #5
  6. ...megan

    Alaspher Guest

    Alaspher, Jan 21, 2005
    #6
  7. ...megan

    T.Willey Guest

    Here is a revised version that will let you select item to unblank with a selection set (crossing, windowing).

    Tim

    (defun c:UnBlank (/ ss ss2 cnt1 tmpEnt tmpData ocmd)
    ; UnBlank an object by selecting it in the current tab.

    (setq ocmd (getvar "cmdecho"))
    (setvar "cmdecho" 0)
    (command "_.undo" "_end")
    (command "_.undo" "_group")
    (if (setq ss (ssget "x" (list '(60 . 1) (cons 410 (getvar "ctab")))))
    (progn
    (setq cnt1 0)
    (while (setq tmpEnt (ssname ss cnt1))
    (setq tmpData (entget tmpEnt))
    (entmod (subst (cons 60 0) (assoc 60 tmpData) tmpData))
    (redraw tmpEnt 3)
    (setq cnt1 (1+ cnt1))
    )
    (while (setq ss2 (ssget ":S"))
    (while (setq tmpEnt (ssname ss2 0))
    (setq tmpData (entget tmpEnt))
    (entmod (subst (cons 60 1) (assoc 60 tmpData) tmpData))
    (ssdel tmpEnt ss)
    (ssdel tmpEnt ss2)
    )
    )
    (if (/= (sslength ss) 0)
    (progn
    (setq cnt1 0)
    (while (setq tmpEnt (ssname ss cnt1))
    (setq tmpData (entget tmpEnt))
    (if (assoc 60 tmpData)
    (entmod (subst (cons 60 1) (assoc 60 tmpData) tmpData))
    (entmod (append tmpData (list (cons 60 1))))
    )
    (setq cnt1 (1+ cnt1))
    )
    )
    )
    )
    (prompt "\n Nothing blanked in current tab. ")
    )
    (command "_.undo" "_end")
    (setvar "cmdecho" ocmd)
    (princ)
    )
     
    T.Willey, Jan 21, 2005
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.