Jump to content
Developer Wiki and Function Reference Links ×

How to refresh prior to print?


ionw

Recommended Posts

In the General discussion I was trying to help someone out with a self updating Data Stamp.

I modified a script suggested by VectorGeek to include Printing.

The script does everything it should, except that it sends the version prior to updating to the printer. Essentially it prints on the document when the document was last printed.

Is there anyway to reset this prior to sending it to the printer? Thanks,

ion

Procedure printandUpdate;

VAR

h : HANDLE;

i : INTEGER;

Procedure DoIt(h : HANDLE);

BEGIN

ResetObject(h);

END;

BEGIN

ForEachObject(DoIt,PON='Data Stamp');

ReDrawAll;

i:=PrintUsingPrintDialog;

END;

Run(printandUpdate);

Edited by ionw
Link to comment

Thanks for working on this, Ion. I will be really excited (and grateful) if someone figures it out for '08.

There have been so many times that I've been looking at two copies of the same plot, wondering which is newer and if there are any critical details I'd be losing if I issue the wrong one. Until now, my QC method has been to throw them both away a reprint the sheet : )

Thanks,

David

Link to comment

Ion,

The data stamp object actually gets reset after the script completes executing and not within the script as you would expect. If the data being updated is linked to a record field then you can update the field(s) prior to sending to the printer with the following:

Procedure DoIt(h : HANDLE);

VAR

dateStr: STRING;

dateFmt,infoFmt: INTEGER;

BEGIN

dateFmt:= 2;

infofmt:= 1;

dateStr:= Date(dateFmt,infoFmt);

SetRField(h,'Data Stamp','dateFieldName',dateStr);

ResetObject(h);

END;

Link to comment

I think the problem is that the ResetObject() procedure doesn't register until after the script completes its execution. So essentially, the PrintUsingPrintDialog function is printing before the data stamp is updated. It may not be fixable - but I too will try.

Funny how it worked in VW12. NNA, can you shed some light on this?

VG

Edited by VectorGeek
Link to comment

Sing-along everybody.......

island-mon

what you wantin' wit da vector world?

vec-tor geek

want to take you from this digital-world

he want to ween you from the locus tool

he want to take you but you're being a fool

island-mon, island-mon, island-mon, ooo-ooh,

tell me what you wantin' with da vector world?

{with apologies to Sir Elton John, and the inimitable Kiki Dee.}

VectorGeek

--------------------------------------------------

Mac Plus, 1MB RAM, 10MB HD, System 1.2

Currently playing a marathon game of "Dark Castle"

Edited by VectorGeek
Link to comment

Can you create a script that updates the data stamp and then runs a second script to print? It seems like that would allow the stamp to be updated before the print command was initiated and you wouldn't have to click on several menu items to accomplish it.

Two scripts chained together.

David

Link to comment

iThink iMon is saying that we wish we had a script-savy moderater for this forum who was active here, and could definitively explain the what-what on this, and other things. In particular, we'd like an answer to the Geek's question as to why this worked in 12. I think it's a case of the guys who have this wisdom are too busy with development to moderate.

Actually, I'm surprised it did work in 12. My experience so far says that nothing really happens in a script in the step-wise manner we percieve in text. The drawing is not updated until the whole script is done. Therefore you can't chain together 2 scripts in the way David is thinking, cause it becomes one script. You'd need a macro program for that....something more like pShop actions. "run the script called update stamp,save and then run the menu command called print".

Somebody out there might check in at some point and know a workaround. I suppose you could have a print script that popped a dialog saying when the stamp were last updated and if you want to continue, but that would get old pretty fast.

Link to comment

You can't make a script that call's a script after executing, but you can make a script that call's itself again after executing.

I will explain this further.

I had made some plug-in point objects. Sometimes you want the parameters to update before going further into the script. So you'll need to terminate the script and because of the parameter change, the script runs again.

With the correct lines of code, you can let the script run the times you want. I do not know anymore how I did it exactly, but I will look at it.

It worked on plug-in objects, but I do not know if this will work on a menu or tool object. I will check this out.

But what if:

you make a script for updating the stamps.

you make a script for executing those updating scripts.

then the updating scripts will terminate and update the stamps, while the main script still runs. maybe it will work?

Link to comment

This should still work. It uses named text blocks. Creates those if they don't exist. Only one stamp set per file, though.

PROCEDURE PrintAndStamp;

{ ? Diehl Graphsoft (date stamp) & Petri Sakkinen 2003 (filename stamp & object creation) }

VAR

x, y : REAL;

dateNow, fName : STRING;

obHd : HANDLE;

PROCEDURE makeDateStamp;

BEGIN

PUSHATTRS;

MESSAGE('Click to position date stamp');

GETPT(x, y);

TEXTORIGIN(x, y);

NAMEOBJECT('DateStamp');

CREATETEXT(dateNow);

CLRMESSAGE;

POPATTRS;

END;

PROCEDURE makeNameStamp;

BEGIN

PUSHATTRS;

MESSAGE('Click to position filename stamp');

GETPT(x, y);

TEXTORIGIN(x, y);

NAMEOBJECT('FilenameStamp');

CREATETEXT(fName);

CLRMESSAGE;

POPATTRS;

END;

BEGIN

dateNow := DATE(2, 1); { short date with time - see below for optionss }

fName := GETFNAME;

obHd := GETOBJECT('DateStamp');

IF obHd = NIL THEN makeDateStamp ELSE SETTEXT(obHd, dateNow);

obHd := GETOBJECT('FilenameStamp');

IF obHd = NIL THEN makeNameStamp ELSE SETTEXT(obHd, fName);

DOMENUTEXTBYNAME('Print', 0);

END;

RUN(PrintAndStamp);

{ date options:

DATE(0, 1) - full date with time

DATE(0, 0) - full date without time

DATE(1, 1) - abbreviated date with time

DATE(1, 0) - abbreviated date without time

DATE(2, 1) - short date with time

DATE(2, 0) - short date without time

}

EDIT

Of course the items should be in the titleblock, as linked text to a drawing data record; this is how I nowadays handle the situation.

Edited by Petri
Link to comment

The way I had it working in 12(& 9 & 10 & 11)was along the lines of what Miguel was suggesting. We have a titleblock symbol with an attached record. It was a trivial matter to include a print date in as a part of that symbol, and a field in the record. I didn't realize that a PIO would act differently than a record value being displayed in a symbol.

Link to comment

Ion,

I think the reason the PIO works differently is due to how .vso regeneration happens. You're trying to regenerate the Date Stamp pio from within a script to show it's new value, prior to calling print. VW itself handles PIO regeneration after the script ends, despite calling ResetObject within the script.

A parametric object is different from other simple "graphical" objects and records in this regard. It can't regenerate itself and do something based on that regeneration because the new state of on-screen geometry doesn't exist yet.

At least this is how I understand it to be.

Link to comment

Thank you for the explanation Charles. It helps me understand a bit more of what is possible, and what is not.

Petri, many thanks for the script, I must admit I gutted it, and used only the concept of named objects, but that one concept opened up an entirely new method of working to me.

Thanks to all who contributed here,

ion

Link to comment

Yeah, right. You shoud've chosen the little yellow pill.

Californians obviously no longer are what some of us expect them to be...

Just put a date field & a filename field into your "drawing data" record format and link the fields to the titleblock symbol, will'ya!

Link to comment

I know, maybe I am a little tightly wound, but not a native, maybe that explains it...

I already had the required record fields linked to my titleblock symbol. I was trying to answer someone else's question on using the data stamp. Your script simply opened my eyes to something new, the concept of named objects. Maybe I am dense but I never considered that I could uniquely identify one object out of many like objects on a drawing. In hindsight all the information was there I just missed it. Then again, it took two versions before I realized you could modify the name of a previously created Viewport... Maybe too many Mother's little helpers trying to assimilate as a Californian?

Cheers!

Link to comment
  • 3 months later...

I was looking for this and finally found it.

I can get Petri's script to run, BUT:

*it will not work if the object is in a symbol

*it will not work if it belong to a titleblock

I now use another method: a symbol that has text linked to a record. This works fine as long as this symbol is not in a drawing border (the pio).

Does anyone figured something out for updating date and time in a drawing border?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...