Print Multiple page numbers without having to constantly open TEXTEDIT

Print Multiple page numbers without having to constantly open TEXTEDIT

Anonymous
Not applicable
1,311 Views
20 Replies
Message 1 of 21

Print Multiple page numbers without having to constantly open TEXTEDIT

Anonymous
Not applicable

Hey so I have always thought this was one of my duties i couldve made a lot more efficient. I create various sheets for jobs with multiple pallets called Travelers. First I find out how many pallets Travelers I will need to make and insert that number on to the drawing with TEXTEDIT. Then Based on How many pieces go per pallet I print out every sheet sequentially (ex. 01 of 10, 02 of 10, 03 of 10 and so on) using TEXTEDIT.

 

heres a picture

1.JPG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 Of course when I have over 20 Travelers it gets really tedious and time consuming to do the whole

 

-double click

-change number

-enter

-ctrl+p

-enter

-repeat

 

So Is there a macro or even a command that will do this for me?

0 Likes
Accepted solutions (2)
1,312 Views
20 Replies
Replies (20)
Message 2 of 21

rkmcswain
Mentor
Mentor

Sheet set manager has been doing this for over almost a decade.
Is there some reason you can't use that?

R.K. McSwain     | CADpanacea | on twitter
Message 3 of 21

alexKoshman
Collaborator
Collaborator

I think there is such a reason.

It's called: "ONE SHEET PER ONE DRAWING AT A TIME"...

: ((

 

I think it's AWFUL!..

Message 4 of 21

Anonymous
Not applicable

I looked into sheet set manager, I dont know how really to apply this in this situation since my program creates a single sheet at a time and thats all we print and it spits it out as XX of XX and i go into the file and add the numbers manually and eventually go through and print every single iteration '1 of 20, 2 of 20, 3 of 20'

0 Likes
Message 5 of 21

redtransitconsultants
Collaborator
Collaborator

I'm not sure what Travelers is - software add on? Never heard of it.

 

Sheet Set Manager is the way to go for managing sheet numbers - but if you're getting sheets from some other software it likely won't work. Are the sheet numbers done as an attribute block at least? If so you could probably write a lisp to assist the editing.

Steve Hill,Civil Designer / .NET Developer / AutoCAD and AutoCAD Civil 3D Certified Professional
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

http://redtransitconsultants.com/
Autodesk Exchange Store
Twitter | LinkedIn | YouTube

0 Likes
Message 6 of 21

hmsilva
Mentor
Mentor

Hi adrian.sorola,

 

post a sample dwg, with a few 'Travelers', with a before and after state, it will be easier to help...

 

Henrique

EESignature

0 Likes
Message 7 of 21

Anonymous
Not applicable

ok what I just posted is called a traveler, when we manufacture multiple pieces and we have to put them on multiple pallets so as they move around the shop  we need to be able to identify the pallet because the pieces dont all get finished at the same time. This is where travelers come in. We leave a traveler on the pallet that tells operators what order the pieces belongs to for tracking purposes. When I run my program that pulls the traveler .dxf file and populates it with the dimension it saves it and then I go in and manually change the XX of XX to say for example 01 of 10 then 02 of 10. I usually just click the 01 and then it lets me TEXTEDIT that  and i change it and then press print and then i repeat for every single page . The problem that has been getting to me lately is ive had to make 50, 60 or even 100 travelers because theres so many pieces and thus so many pallets.

0 Likes
Message 8 of 21

hmsilva
Mentor
Mentor

Adrian,

the reason why I asked

 

'post a sample dwg, with a few 'Travelers', with a before and after state, it will be easier to help...'

 

It was to try to understand the relation between the 'Traveler' localization and the final number, to do this I need more than one...

Are numbering assigned from left to right, from top to bottom, ???

Do you want to select the "XX" one by one, and from that selection order, the numbering will be assigned?

 

EDIT: if the order don't matter, maybe something like this do the trick...

 

(defun c:demo (/ ent i n ss1 ss2 str)
  (if (and (setq ss1 (ssget "_X" (list '(0 . "TEXT") '(8 . "TESTI") '(1 . "OF XX") (cons 410 (getvar 'CTAB)))))
           (setq ss2 (ssget "_X" (list '(0 . "TEXT") '(8 . "TESTI") '(1 . "XX") (cons 410 (getvar 'CTAB)))))
      )
    (progn
      (setq i   (sslength ss1)
            str (itoa i)
      )
      (if (= (strlen str) 1)
        (setq str (strcat "0" str))
      )
      (setq str (strcat "OF " str))
      (repeat i
        (setq ent (entget (ssname ss1 (setq i (1- i)))))
        (entmod (subst (cons 1 str) (assoc 1 ent) ent))
      )

      (setq n 0)
      (repeat (setq i (sslength ss2))
        (setq ent (entget (ssname ss2 (setq i (1- i))))
              n   (1+ n)
              str (itoa n)
        )
        (if (= (strlen str) 1)
          (setq str (strcat "0" str))
        )
        (entmod (subst (cons 1 str) (assoc 1 ent) ent))
      )
    )
  )
  (princ)
)

 

Hope this helps,
Henrique

EESignature

0 Likes
Message 9 of 21

Anonymous
Not applicable

the various travelers all come from the same xx of xx .dwg here is some extras. The final number stays the same. in this case 64 remains 64 the first number changes every time i print the traveler. The goal would be to be able to take the original .dwg and specify that i need say 50 travelers and then my printer would begin printing sequentially 1 of 50 , 2 of 50, 3 of 50, 4 of 50, 5 of 50.

0 Likes
Message 10 of 21

hmsilva
Mentor
Mentor

@Anonymous wrote:

the various travelers all come from the same xx of xx .dwg here is some extras. The final number stays the same. in this case 64 remains 64 the first number changes every time i print the traveler. The goal would be to be able to take the original .dwg and specify that i need say 50 travelers and then my printer would begin printing sequentially 1 of 50 , 2 of 50, 3 of 50, 4 of 50, 5 of 50.


Adrian,

let's see if I understood your workflow.

 

You only have one .dwg opened each time?

Not all travelers in one dwg?

 

So, it will be:

  • Open one .dwg
  • Change the numbers.
  • Plot.
  • Open another .dwg
  • Change the numbers.
  • Plot.
  • ...

And you need to:

  • Open one .dwg
  • Set the total travelers
  • Change the numbers by code.
  • Plot.
  • Open another .dwg
  • Change the numbers  by code.
  • Plot.
  • ...

 

Correct?

 

Henrique

EESignature

0 Likes
Message 11 of 21

Anonymous
Not applicable

you are correct up until the point where I plot.

  • open .dwg
  • change numbers
  • plot
  • change numbers in the same .dwg
  • plot

you can imagine that if i had to do this 100 times it would slow me down, even with my keystrokes memorized

 

and the goal is to

  • open .dwg
  • set total number of travelers
  • autodesk begins to plot all individual travelers without me having to manually change the number each time i plot

i dont know if this is wishful thinking but I just wanted to know how something like this is done that way in the future I can use what i learned and use it in different applications

0 Likes
Message 12 of 21

lando7189
Advocate
Advocate

So... if the drawing you are printing is opened, what you would need is a prompt to pick the 2 pieces of text affected that will be changed, and then enter a number for the total number of copies.  The program would then change the 'total' text entity to the number of pages to be printed, and then begin iterating a loop, incrementing the other text entity and print it. Correct?

Message 13 of 21

Anonymous
Not applicable

Yes correct!

 

thats pretty much exactly what I am envisioning

 

a prompt that would ask "total pages?" and begin the loop of printing each page incrementally.

0 Likes
Message 14 of 21

lando7189
Advocate
Advocate
Accepted solution

This should get you started in the right direction:

(defun C:MPLOT ( / dxf ent1 ent2 total i fn)
  (defun dxf (code EnameOrElist / VarType)
    (setq VarType (type EnameOrElist))
    (if (= VarType (read "ENAME"))
      (cdr (assoc code (entget EnameOrElist)))
      (cdr (assoc code EnameOrElist))
    )
  )
  (cond
    ((not (setq ent1 (entsel "\nSelect the text that will be the counter...")))
     (princ "\nNothing selected")
    )
    ((not (= (dxf 0 (setq ent1 (car ent1))) "TEXT"))
     (princ "\nSelected entity is not text")
    )
    ((not (setq ent2 (entsel "\nSelect the text that will be the 'of total'...")))
     (princ "\nNothing selected")
    )
    ((not (= (dxf 0 (setq ent2 (car ent2))) "TEXT"))
     (princ "\nSelected entity is not text")
    )
    (T
      (initget 7)
      (if (setq total (getint "\nTotal number of pages to print:  "))
        (progn
          (setq ent1 (vlax-ename->vla-object ent1)
                ent2 (vlax-ename->vla-object ent2)
          )
          (vla-put-TextString ent2 (strcat "OF " (itoa total)))
          (setq i 1)
          (while (<= i total)
            (vla-put-TextString ent1 (itoa i))
            ;(setq fn (strcat "c:/temp/" (itoa i) ".plt"))
            ;(vla-PlotToFile (vla-get-plot (vla-get-ActiveDocument (vlax-get-acad-object))) fn )
            (vla-PlotToDevice (vla-get-plot (vla-get-ActiveDocument (vlax-get-acad-object))))
            (setq i (1+ i))
          )
        )
      )
    )
  )
  (princ)
)
Message 15 of 21

Anonymous
Not applicable
Ill try this and give you some feedback
0 Likes
Message 16 of 21

Anonymous
Not applicable

Hey guys sorry for the late reply,

 

I was tinkering and applying the code in different ways whenever i had some free time and It works right  once i load it into autocad

 

it prompts me to choose the first text

then it prompts me to choose the second text

and then it asks me how many copies

 

this is what Happens after however

 

2.jpg

there is the "error: no function definition: VLAX-ENAME->VLA-OBJECT

 

i tried looking through it and even defining it but I dont even know where to begin

 

are those user defined functions?

0 Likes
Message 17 of 21

alexKoshman
Collaborator
Collaborator
Accepted solution

Hello!

I think you have to add a string

(vl-load-com)

as the second string in this code!

Right after the

(defun C:MPLOT ( / dxf ent1 ent2 total i fn)

 

The respected author just forgot to add this to his codde... because it's banality! ; ))

Message 18 of 21

lando7189
Advocate
Advocate

vl-load-com.... ahhhh.... yes.  

 

I forgot about that....i'm so use to having that load right away as part of my acad.lsp file.

0 Likes
Message 19 of 21

alexKoshman
Collaborator
Collaborator

; )) Understand you completely!

0 Likes
Message 20 of 21

Anonymous
Not applicable

It works!!!

 

the only hang up is I need to know how to select a certain plot device. it runs the code but then i get the yellow bubble on the bottom right hand corner that says plot error. the error stems from not having a plot device selected. In my case i need to have my 4V plotter selected

 

thank you guys

0 Likes