LISP to help with keeping track if completed drawings?

LISP to help with keeping track if completed drawings?

Anonymous
Not applicable
1,246 Views
11 Replies
Message 1 of 12

LISP to help with keeping track if completed drawings?

Anonymous
Not applicable

Hey Guys, First post here:

 

I was wondering if someone could make me a lisp that does the following:

-After typing "FIN" I would like it to take the current layout tab (regardless of what it's called, in this example it is M-101, see image 1) and add a tick mark to the end as seen in image 1.

-I would like to do this throughout the drawing to keep track of what sheets are finished. When I am done the tabs will look like image 2. 

-When all is done I would like to type "UFIN" (regardless of what layout I'm on) and have all tick marks removed from all sheets while maintaining the original sheet names. In this case, image 1 lay1 would just say "M-101" as apposed to "M-101✔"

-It is possible I may not have every layout checked when I am done, regardless once "UFIN" is typed I would like the ones without tick marks at the end to be left as is.

 

Hope this is possible, any help is much appreciated!

0 Likes
Accepted solutions (3)
1,247 Views
11 Replies
Replies (11)
Message 2 of 12

Anonymous
Not applicable

@ВeekeeCZ 

 

Hello, what is meant by this? The tick mark works in the layout tab name per the screenshots? Or maybe I'm misunderstanding here. It accepts it as "✓" in notepad++

0 Likes
Message 3 of 12

ВeekeeCZ
Consultant
Consultant
Accepted solution

Got it. Try the FIN

 

(vl-load-com)

(defun c:FIN ( / ctab ntab)

  (if (and (or (/= (getvar "TILEMODE") 1)
	       (alert (strcat "Error: You need to be in a layout.")))
	   (setq ctab (getvar 'ctab))
	   (setq ntab (strcat ctab "\\U+2714"))
	   (or (not (vl-position ntab (layoutlist)))
	       (alert (strcat "Error: Already in use.")))
	   )
    (vla-put-name (vla-item (vla-get-layouts (vla-get-ActiveDocument (vlax-get-acad-object))) ctab) ntab))
  (princ)
  )
Message 4 of 12

Anonymous
Not applicable

That's awesome!! Fin works beautifully. How tricky will ufin be? Also how do I accept two posts as 2 solutions?

0 Likes
Message 5 of 12

Anonymous
Not applicable

Or maybe it would be simpler to make ufin jump to the first layout, only modify the current tab with the "tick",  and then tell it go to every page in order and run the previous line and stop when there are no pages left?

0 Likes
Message 6 of 12

ВeekeeCZ
Consultant
Consultant
Accepted solution

The second. One more is coming.

 

(defun c:UNFIN ( / layouts tabs ntab)

  (setq layouts (vla-get-layouts (vla-get-ActiveDocument (vlax-get-acad-object))))
  
  (if (setq tabs (vl-remove-if-not '(lambda (x) (vl-string-search "\\U+2714" x)) (layoutlist)))
    (foreach tab tabs
      (setq ntab (substr tab 1 (vl-string-search "\\U+2714" tab)))
      (if (or (not (vl-position ntab (layoutlist)))
	      (alert (strcat "Error: "' ntab '" already in use.")))
	(progn
	  (vla-put-name (vla-item layouts tab) ntab)
	  (princ (strcat "\n'" ntab "' has been unmarked."))))))
  (princ)
  )
Message 7 of 12

ВeekeeCZ
Consultant
Consultant
Accepted solution

And the toggle!

 

(vl-load-com)
(defun c:FUN ( / ctab ntab)
  (if (and (or (/= (getvar "TILEMODE") 1)
	       (alert (strcat "Error: You need to be in a layout.")))
	   (setq ctab (getvar 'ctab))
	   (setq ntab (if (vl-string-search "\\U+2714" ctab)
			(substr ctab 1 (vl-string-search "\\U+2714" ctab))
			(strcat ctab "\\U+2714")))
	   (or (not (vl-position ntab (layoutlist)))
	       (alert (strcat "Error: Already in use.")))
	   )
    (vla-put-name (vla-item (vla-get-layouts (vla-get-ActiveDocument (vlax-get-acad-object))) ctab) ntab))
  (princ)
  )
Message 8 of 12

Anonymous
Not applicable

Awesome so how do I use these finished ones?

0 Likes
Message 9 of 12

ВeekeeCZ
Consultant
Consultant

Try it. Then again. And repeat. And once more. And again. It never gets old.

0 Likes
Message 10 of 12

ВeekeeCZ
Consultant
Consultant

@Anonymous wrote:

... Also how do I accept two posts as 2 solutions?


Just keep pushing the buttons as you like.

0 Likes
Message 11 of 12

Anonymous
Not applicable

These all work awesome!! Thank you so much. I've marked all 3 as solutions.

Message 12 of 12

ВeekeeCZ
Consultant
Consultant

Just a few notes in case you would also add the ticks manually or rename tabs.

It presumes that the tick is the very last character.

Also, note there are 2 different ticks, code 2713 and 2714. It works with the latter ones only.

Not like it could not be enhanced to accommodate the above but it just makes it more complicated.

0 Likes