Vectorworks, Inc Employee Robert Anderson Posted November 30, 2007 Vectorworks, Inc Employee Share Posted November 30, 2007 (edited) I cobbled out a little useful general purpose script for resetting all instances within a drawing of a selected PIO. (Ain't VectorScript grand?) Here it is. PROCEDURE Reset_All_Like_Selected; CONST kErrStr_no_select = 'ERROR: Nothing selected. Select an example of the object type you want to reset and run this script again.'; kConfirm_prefix = 'Are you sure you want to reset all objects of type "'; kConfirm_suffix = '"?'; VAR PIO_name:STRING; BEGIN IF fsactlayer <> NIL THEN BEGIN PIO_name := GetName(GetRecord(fsactlayer,NumRecords(fsactlayer))); IF YNDialog(concat(kConfirm_prefix,PIO_name,kConfirm_suffix)) THEN ForEachObject(ResetObject, R IN [PIO_name]); END ELSE Alrtdialog(kErrStr_no_select); END; RUN(Reset_All_Like_Selected); Edited December 5, 2007 by Robert Anderson Quote Link to comment
ccroft Posted December 10, 2007 Share Posted December 10, 2007 PIO_name := GetName(GetRecord(fsactlayer,NumRecords(fsactlayer))); Interesting bit of wisdom here. I was wondering why NumRecords for the GetRecord index so I played with this one a bit. One works fine....as long as there aren't any other records besides the parameter record attached to the PIO. Sooo...the parameter record, it turns out, is always the last one in the list of records attached to a PIO, so if there's 2 others attached, NumRecords returns 3 and that's the index for the record that returns the PIO name. Obvious to some I guess, but not me. Thanks Robert, Charles Quote Link to comment
Vectorworks, Inc Employee Robert Anderson Posted December 10, 2007 Author Vectorworks, Inc Employee Share Posted December 10, 2007 Yes, the PIO parameter record will always be the Nth record attached to a PIO that has N records attached. By the way, this is documented nowhere AFAIK and is the result of trial-and-error testing, whence cometh so much profound programming knowledge Quote Link to comment
Recommended Posts
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.