Assembly Posted March 4, 2009 Share Posted March 4, 2009 I'm looking though the preference files. I find text files with tab delineated entry that PIO's reference. Is it possible to script so that the popup options for a plugin refer to an external file like this, if so how?. Quote Link to comment
Pat Stanford Posted March 4, 2009 Share Posted March 4, 2009 Most of the NNA PIOs that use "standard" sizes read that data in from a text file using the Open, and Read or ReadLn commands to pull the data from the file into an array. When you pick the data that you need, either use the data in the array directly, or copy it into variables that may be easier to work with. Quote Link to comment
Assembly Posted March 4, 2009 Author Share Posted March 4, 2009 thanks for the lead in pat. can you post an example of this in action?. Quote Link to comment
Pat Stanford Posted March 4, 2009 Share Posted March 4, 2009 Definitely not tonight, and probably not this week. Actually, I don't think I have ever actually done this, but am giving the conceptual answer. I might have one script around that does this. I will try to look tomorrow. Quote Link to comment
panta rhei Posted March 4, 2009 Share Posted March 4, 2009 There is a function with a promising description vsoInsertWidget which has a pop-up as an option. There is some documentation of it here: http://developer.vectorworks.net/index.php?title=VS:Parametric_Custom_Shape_Pane Haven't tried it yet. Quote Link to comment
Miguel Barrera Posted March 4, 2009 Share Posted March 4, 2009 Look at the article: http://developer.vectorworks.net/index.php?title=VS:Parametric_Custom_Shape_Pane apparently, the functionality is available in VW2009 (could not verify since I have VW2008) Also as an alternative to using text files, which requires more coding to implement, explore using String Data in the script editor. If the data will not change over the years, then this will be an easier solution. Quote Link to comment
ccroft Posted March 5, 2009 Share Posted March 5, 2009 (edited) can you post an example of this in action?. I can post some snips and maybe you can put them into action. The main script this was done for is very 'file specific' and rather large, so that posting it as a working script doesn't make much sense. It won't do anything without a lot of other stuff in place in the drawing and a properly formatted text file to read on the hard-drive. This example reads some info from a tab delimited text file that has 3 entries per line. This data is read into a 2 dimensional array that's 3 columns wide. After the array is loaded the info is written from the array to records attached to certain objects in the drawing. This info could just as easily be written into the parameter record of a PIO. If you're doing that you won't want to use GetFile. Look in VSFR under File I/O for Open and Close, and other functions for file handling. CONST ???kMaxLines=200; VAR ???date,node_num,reading,data_file:STRING; ???node_info:ARRAY[1..kMaxLines,1..3] OF STRING; Procedure read_info; ???Begin ??????line_num := 0; ??????REPEAT ?????????line_num := line_num + 1; ?????????ReadLn(date,node_num,reading); ?????????node_info[line_num,1] := date; ?????????node_info[line_num,2] := node_num; ?????????node_info[line_num,3] := reading; ??????UNTIL (EOF(data_file)) or (line_num = kMaxLines); ???End; The part of the main body that calls the above: BEGIN ???GetFile(data_file); {you'll want to do different here for reading into PIO} ???IF NOT DidCancel THEN ??????Begin ?????????read_info; ?????????attach_record; ?????????ForEachObject(write_info,C='nodes'); ?????????ForEachObject(draw_flags,C='nodes'); ??????End; END; Hope this is enuf to get your ball rolling. WARNING: working with arrays and data files can be very finicky & hazardous to your mental health. (option-spaced out) Edited March 5, 2009 by ccroft Quote Link to comment
Assembly Posted March 5, 2009 Author Share Posted March 5, 2009 Thanks Charles... that looks like some fun to figure out. The widget in the link posted looks promising too. My tip for the week is www.weebly.com a free cloud based webdesign / host site. you can see a couple of my 3d rendered details at http://assembly.weebly.com/drawings.html 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.