TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Andrea on December 06, 2007, 03:17:33 PM

Title: Get Number of copies.
Post by: Andrea on December 06, 2007, 03:17:33 PM
Hi all,

I'm trying to get the last number of plot copy..

Code: [Select]
(vl-load-com)
(vla-get-NumberOfCopies
(vla-get-Plot
(vla-get-ActiveDocument
(vlax-get-acad-object)
)
))

But this code return me always 1
Can anyone explain me why ?

thanks.
Title: Re: Get Number of copies.
Post by: Jeff_M on December 06, 2007, 03:26:04 PM
I think that this always resets to 1 after the plot completes. Try plotting from the Acad editor, change the # of copies to 2, complete the plot. Now go back to plot again, note the # of copies is 1 again?

Title: Re: Get Number of copies.
Post by: Andrea on December 06, 2007, 03:34:12 PM
Thanks Jeff for you quick response..

but if it is, what is the utility to have the vla-get-NumberOfCopies  function ?
and where to use this ? I can't find any sample on the net.
Title: Re: Get Number of copies.
Post by: T.Willey on December 06, 2007, 03:40:49 PM
I wonder if you could use that in the end command reactor to get the correct number of prints?  /guess

Edit:  Nope.  Didn't work here on a quick test.
Title: Re: Get Number of copies.
Post by: Andrea on December 06, 2007, 03:42:42 PM
Thanks Mr. Willey

This option was tried...

any else ? or in simple lisp maybe ?

Title: Re: Get Number of copies.
Post by: T.Willey on December 06, 2007, 03:45:35 PM
Not that I can see.  Maybe in a more powerful language, but that is just a guess also.  Sorry.
Title: Re: Get Number of copies.
Post by: deegeecees on December 06, 2007, 04:21:38 PM
I use a database for this, and just incremement by one every time the drawing is plotted. Not sure if this is a solution, but figgered I'd throw it out there.
Title: Re: Get Number of copies.
Post by: T.Willey on December 06, 2007, 04:54:40 PM
I use a database for this, and just incremement by one every time the drawing is plotted. Not sure if this is a solution, but figgered I'd throw it out there.
I think the question is more if the person prints it twice within one print command, how do you know that you just printed twice instead of only one.
Title: Re: Get Number of copies.
Post by: deegeecees on December 06, 2007, 05:02:08 PM
Ahh yes. Never had the need to play with that.
Title: Re: Get Number of copies.
Post by: Jeff_M on December 06, 2007, 05:06:27 PM
No time to check this out, but can you get the correct NumberofCopies when the BeginPlot Event is triggered?
Title: Re: Get Number of copies.
Post by: KewlToyZ on December 06, 2007, 10:03:24 PM
Just curious, if your using a newer version (2008) is PUBLISHCOLLATE set to 0?
Publishcollate generates publishing as a single file instead of multiple files.
Title: Re: Get Number of copies.
Post by: Andrea on December 07, 2007, 01:28:00 PM
thank Kew..  :-)

I don't know about PUBLISHCOLLATE I'll give it a try monday at the office

Have a nice W.E. all.

Title: Re: Get Number of copies.
Post by: daron on December 10, 2007, 08:48:25 AM
I use a database for this, and just incremement by one every time the drawing is plotted. Not sure if this is a solution, but figgered I'd throw it out there.
I think the question is more if the person prints it twice within one print command, how do you know that you just printed twice instead of only one.
Wouldn't (setq varname (vla-get-numberofcopies (...))) save the number of copies in varname? You could set this as a global variable for use later or set it in one of the integer variables, could you not?
Title: Re: Get Number of copies.
Post by: T.Willey on December 10, 2007, 11:04:46 AM
I use a database for this, and just incremement by one every time the drawing is plotted. Not sure if this is a solution, but figgered I'd throw it out there.
I think the question is more if the person prints it twice within one print command, how do you know that you just printed twice instead of only one.
Wouldn't (setq varname (vla-get-numberofcopies (...))) save the number of copies in varname? You could set this as a global variable for use later or set it in one of the integer variables, could you not?
I don't think it can be done with lisp.  I checked that property in my plot reactor, but it would print out 1 when it should have been 3.  I think you would have to got at least with VBA as Jeff pointed out, with the BeginPlot event.
Title: Re: Get Number of copies.
Post by: daron on December 10, 2007, 12:19:03 PM
That's odd. I inspected:
Code: [Select]
(setq noc (vla-put-NumberOfCopies (vla-get-Plot (vla-get-ActiveDocument (vlax-get-acad-object))) 3))with a result of nil, then inspected:
Code: [Select]
(vla-get-numberofcopies (vla-get-Plot (vla-get-ActiveDocument (vlax-get-acad-object))))with a return value of 3. If you just inspect the (vla-get-plot (...)), you should see a <NumberOfCopies> 3 in the inpection popup in the vlide. Maybe I'm just not understanding what's being asked here, but it seems retained to me. Using 2006 plain. What all that really tells me, is you don't even need to setq varname this one.
Title: Re: Get Number of copies.
Post by: T.Willey on December 10, 2007, 12:38:57 PM
That's odd. I inspected:
Code: [Select]
(setq noc (vla-put-NumberOfCopies (vla-get-Plot (vla-get-ActiveDocument (vlax-get-acad-object))) 3))with a result of nil, then inspected:
Code: [Select]
(vla-get-numberofcopies (vla-get-Plot (vla-get-ActiveDocument (vlax-get-acad-object))))with a return value of 3. If you just inspect the (vla-get-plot (...)), you should see a <NumberOfCopies> 3 in the inpection popup in the vlide. Maybe I'm just not understanding what's being asked here, but it seems retained to me. Using 2006 plain. What all that really tells me, is you don't even need to setq varname this one.
Don't put the property, just plot and in the dialog tell it you want three plots.  I did pdf's not to waste paper, then check the value.  Mine said 1 even though it should have said 3.
Title: Re: Get Number of copies.
Post by: daron on December 10, 2007, 12:57:23 PM
No, I understand that. I thought this was a coding question. If you set the put-NOC to a value, then the get-NOC to a variable, immediately after it, you should have the value contained and be able to reuse it within the same call or be sure and set the variable globally... Hmm. Just had a thought, if he wanted to go from drawing to drawing, even a variable in global scope wouldn't work. However, I wonder if vl-bb-set and -ref would be useful. I haven't messed with them in a while. Then again, a long workaround would be to write-line it to a txt file somewhere as write not append, then always call that info from the text file when plotting in another drawing.