Pat Stanford Posted January 30, 2008 Share Posted January 30, 2008 OK, how about a partial solution. The attached script will create a worksheet showing both the display names and the record/field name needed to paste into a database header row in a worksheet. The created worksheet will be named with the name of the PIO and the date/time it was created (this is so I don't confuse myself if I am creating new PIOs). The Record.Field are enclosed in single quotes so you can just copy and paste the entire field without having to worry about spaces in the names. Please use as you see fit. Pat Procedure GetPIORecordFields; {Creates a worksheet showing the display and field names} {for the first selected object on the active layer} {Useful for determining the record.field names required} {for use in a worksheet.} {January 30, 2008} {? 2008, Coviana, Inc - Pat Stanford pat@coviana.com} {Licensed under the GNU Lesser General Public License} Var H1 ,H2 :Handle; S1,S2,S3,S4 :String; N1,N2 :Integer; WSH :Handle; B1 :Boolean; Begin H1:=FSActLayer; H2:=GetRecord(H1,1); {get a handle to the first record} If H2 <> Nil then Begin {If a record exists then create worksheet} S1:=GetName(H2); N1:=NumFields(H2); N2:=1; S3:=''; WSH:=CreateWS(Concat(S1,' ',Date(2,1)),N1+2,2); SetWSPlacement(WSH,200,200,800,700); SetWSColumnWidth(WSH,1,1,200); SetWSColumnWidth(WSH,2,2,200); SetWSCellFormula(WSH,1,1,1,1,Concat('Parameter Fields for PIO: ',S1)); SetWSCellFormula(WSH,3,1,3,1,'Display Name'); SetWSCellFormula(WSH,3,2,3,2,'Cell Formula'); While N2<=N1 Do Begin {populate the worksheet with all the fields} S2:=GetFldName(H2,N2); S3:=Concat(Chr(39),S1,'.',S2,Chr(39)); SetWSCellFormula(WSH,N2+3,2,N2+3,2,S3); B1:=GetLocalizedPluginParameter(S1,S2,S4); SetWSCellFormula(WSH,N2+3,1,N2+3,1,S4); N2:=N2+1; end; ShowWS(WSH,True); SetTopVisibleWS(WSH); end; End; Run(GetPIORecordFields); Quote Link to comment
boxjoint Posted January 31, 2008 Share Posted January 31, 2008 Thank you Pat. I will try this out in the next day or two. I appreciate your time spent. Quote Link to comment
Gerrit Posted January 31, 2008 Share Posted January 31, 2008 Nice scripting, Pat - works like a charm. Thanks. Quote Link to comment
boxjoint Posted January 31, 2008 Share Posted January 31, 2008 Pat, Thanks again. I tried the script and it works great. It took me a minute to figure out that it wouldn't work on PIO's that were inserted into walls, like doors or windows, but dragging them free of the wall solved the problem. A great advantage to having the info on a worksheet is that you can see it WHILE you are working on another worksheet, unlike using the PlugIn Editor which will not allow you to work with anything else while it is open, meaning that you must write down or memorize the info that you seek. I think this is a huge improvement. Quote Link to comment
Guest Wes Gardner Posted January 31, 2008 Share Posted January 31, 2008 Nice script Pat... beats the flang out of my 267 word diatribe! Quote Link to comment
Pat Stanford Posted February 1, 2008 Share Posted February 1, 2008 Well code can be very succinct (The script is only 127 words), but your description is more along the lines of teaching a man to fish while I just gave him a fish. Both are good things. ;-) Pat Quote Link to comment
michael john williams Posted February 1, 2008 Author Share Posted February 1, 2008 Goooooooooosh! Come back after a day and a hugh thread - and all good stuff, which at the mo I do not understand but I am gratful for the input and will give it a go. It will take at least a day to play around with it and try it out and set it up as our office template. But I suppose that's my point to the average user this sounds so complicated and not user friendly that it is not used. I do not know the first thing about scripts and I feel I would have to be a CAD programmer to really do it. The VW help section on worksheets and schedules is poor and so minimal. NNA are pushing BIM but if its hard to understand and use then it will not be used and fail. NNA should backing up the push for BIM with workable templates and not just US based but other countries as well. Look at Excel, there are hundreds of templates easily available and easy to adapt. Quote Link to comment
boxjoint Posted February 1, 2008 Share Posted February 1, 2008 Michael, Don't confuse scripting with the worksheets and schedules. You don't need to write scripts to use worksheets. You just need to follow Wes's directions and the Help files to modify the schedules that are provided. It's convoluted to say the least, especially if you don't do it often, but it isn't terribly hard. You should definitely keep trying. The script that Pat provided is a completely different thing. It's like learning another language. I've looked longingly at those scripts but I just don't have the time to devote to learning it. Quote Link to comment
bclydeb Posted February 2, 2008 Share Posted February 2, 2008 Boxjoint, Go to the wish list and submit a "wish" for the feature you described. I think it is a good Idea! Quote Link to comment
boxjoint Posted February 2, 2008 Share Posted February 2, 2008 bclydeb, Thanks. If you mean the idea about accessing the PIO names from the worksheet, I have already added it to the wishlist here: http://techboard.nemetschek.net/ubbthreads/ubbthreads.php?ubb=showflat&Number=96493&page=1#Post96493 Don't be shy about adding your support to that thread too. I get the sense that 'the squeaky wheel gets the grease' when dealing with wishes. Quote Link to comment
Vectorworks, Inc Employee Hugues Posted February 4, 2008 Vectorworks, Inc Employee Share Posted February 4, 2008 boxjoint, pat and all, There is another solution for accessing PIO names that doesn't involve using the VS Plug-in editor or scripting. You can do this directly from the worksheet using the Paste Criteria command. Proceed as follows: - Enter the equal sign in the formula bar - Click on the "Paste Criteria..." command in the worksheet menu - The Paste Attributes dialogs opens , then click on the 'Custom' button. - Now in the Criteria dialog, select the Field Value criterion, pick your PIO field and make sure you set the criteria operator to 'NONE' (third pulldown menu). - Click OK and you are done. We are well aware that accessing PIO names from the worksheet isn't straightforward and intuitive. This area is on the radar and we are working on better solutions. Hugues NNA Quote Link to comment
boxjoint Posted February 4, 2008 Share Posted February 4, 2008 Hugues, Thank you for the reply. Your tip works well. Thanks also for planning future improvements on this. Quote Link to comment
Pat Stanford Posted August 19, 2008 Share Posted August 19, 2008 An updated version of the PIO Fields to Worksheet script has been posted here: http://techboard.vectorworks.net/ubbthreads/ubbthreads.php?ubb=showthreaded&Number=108487#Post108487 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.