Vectorworks, Inc Employee Matt Panzer Posted February 12, 2010 Vectorworks, Inc Employee Share Posted February 12, 2010 Hi Gio, It works now! :-) I added a one-liner subprocedure and a ForEachObject statement in place of: NameClass(LOC_ClassArray[x]); SetClassOptions(1); SelectAll; SetClass(h,assign_to); This method should be much faster and also will look inside symbols and groups. http://pastebin.com/m53c80150 Quote Link to comment
GioPet Posted February 12, 2010 Author Share Posted February 12, 2010 aha.. I had just edited the previous post.. in the meantime I worked out this ForEachObject(AssignThem, SEL); SEL criteria did the job, when calling the procedure PROCEDURE AssignThem(h :HANDLE); BEGIN IF GetClass(h) = LOC_ClassArray[x] THEN SetClass(h, assign_to); END; thanks anyway! Quote Link to comment
Vectorworks, Inc Employee Matt Panzer Posted February 12, 2010 Vectorworks, Inc Employee Share Posted February 12, 2010 You're welcome. You did almost exactly what I did! :-) I'd still recommend my version since it doesn't change the active class or selection state of any objects. This should make it run faster and leave the drawing state as the user would expect. Plus it should work on objects within symbols and groups. If you have a large file to test on, try both versions to see if there's a difference. Quote Link to comment
GioPet Posted February 12, 2010 Author Share Posted February 12, 2010 Thanks Matt, i will test what you said sometimes next week, and still need to work on the Undo Button!! Now, here is a Cleaner version.. .vsm File or http://pastebin.com/m67ebd879 I got rid of some local and Global variables that were flying around without being very useful.. have a good weekend G Quote Link to comment
Vectorworks, Inc Employee Matt Panzer Posted February 12, 2010 Vectorworks, Inc Employee Share Posted February 12, 2010 Glad to help Gio. You have a good weekend as well. I plan to make mine restful. I've shoveled far too much snow this week... Quote Link to comment
_c_ Posted February 13, 2010 Share Posted February 13, 2010 Ciao Giovanni, did you consider building the LB on resource lists passing obj type 94? Using the resource lists you are also able to offer the choice of items residing in the standards folder, moreover the list is automatically alpha-sorted, which is good. i := 0; WHILE GetNumLBItems(gD, cLB_Left) < gNumClasses DO BEGIN clN := GetActualNameFromResourceList(gClassList, inc(i)); ..... I can't try the script now, but it looks nice! orso Quote Link to comment
GioPet Posted February 20, 2010 Author Share Posted February 20, 2010 Ciao Orso! thanks for the suggestion. I hadn't thought about passing obj type 94, it actually sounds a much more straight forward way to build the resource list. I will go through the script again, hopefully soon.. If anyone who has tried the plug in had other suggestions, please let us know! Bis Bald G Quote Link to comment
Ray Libby Posted February 20, 2010 Share Posted February 20, 2010 This is working great, thanks again. I really can't think of any way to improve it. Quote Link to comment
GioPet Posted March 17, 2010 Author Share Posted March 17, 2010 (edited) Hello Everyone! Here is a new Downloadable Script for the Smart Paste! Download both attachments (_DialogBuilderUtilities.txt is needed too) or View the Script Here http://pastebin.com/18FHi3iv I have Re-written the Script using Resource Lists to Build the List Browsers as suggested by Orso. This worked Smoothly (thanks orso). I also worked out the Undo Button. I had to use arrays because I faced some problems in outputting the User selections to a txt file and then reading them back to Undo the Actions. If anyone can give me some hints on this, it would be good.. I still have the intention to implement the functionality of saving the User's Choices so that the plug in will be able to do part of the Job automatically, without the User to always re-select already made associations (Matt, I think you suggested this at some point..) Many Thanks to everyone for helping out with this so far!!! Gio PS: this script has only been tested on a Mac version of Vectoworks 2009. Please let me know anyone experiences problems with other versions. Edited March 17, 2010 by Gio Pet Quote Link to comment
starling75 Posted March 18, 2010 Share Posted March 18, 2010 Nice one. It works ok on the windows machine. Thanks! Quote Link to comment
G-Pang Posted March 19, 2010 Share Posted March 19, 2010 Hi Gio, It would be good if the dialog box can show which existing class has been assign to incoming class after click the Assign button. for large copy element which consist of a lot of classes, it is good if we can do a final checking ( correct assign ) before we proceed to OK button. for large project, it is very difficult to correct it if we assign wrongly. Once the new paste element has been park under current existing class which consist thousand of objects. it will be though to fix it. btw. it is nice script. credit to you. G-Pang Quote Link to comment
GioPet Posted March 19, 2010 Author Share Posted March 19, 2010 G-Pang, Great suggestion! I will implement this and post it as soon as it's done. Thanks G Quote Link to comment
Vectorworks, Inc Employee Matt Panzer Posted April 7, 2010 Vectorworks, Inc Employee Share Posted April 7, 2010 I finally got a chance to look at this. Well done Giovanni! I've not played around with resizable dialog, but I'm sure you're aware of the LB widths not sizing correctly. This will be a good command to have on hand. Keep us posted on any updates. :-) Quote Link to comment
Assembly Posted April 8, 2010 Share Posted April 8, 2010 (edited) If you want to load use an external file use the XML functions. Here is a snippet to get started. When you script is executed you will want to write to the XML file what the old class was and what the new class is When you load your script you will want to load the XML file and see if there are any classes to be reassigned with defaults if so set the default. ___________________ PROCEDURE GetXML; CONST kLibraryFolder =-13; {constant to set the file path to the VW library folder} VAR hXML :LONGINT; xmlFile :STRING; result :INTEGER; BEGIN; hXML := InitXML; IF hXML <> 0 THEN BEGIN xmlFile := 'ClassAssign.xml'; result := ReadXMLFile(hXML, kLibraryFolder, xmlFile); DATAPath:=Concat('/Prefs/',ClassName[]); {defines the classname path, upto you how to this is structured.} result := GetElementValue(hXML, DATAPath, NewClassName[])); {this will return the value to NewClassName[]} result := ReleaseXML(hXML); END ELSE BEGIN SysBeep; Message('Could not initialize XML reader.'); END; END; Edited April 8, 2010 by Assembly Quote Link to comment
GioPet Posted April 13, 2010 Author Share Posted April 13, 2010 Hello Everyone! Great Inputs guys!! Assembly, this is great, exactly what I needed.. hopefully will not take to long before the next update! G Quote Link to comment
GioPet Posted June 28, 2010 Author Share Posted June 28, 2010 I finally had some time to carry on some work on the Smart Paste. I updated the latest version on the following post: http://techboard.vectorworks.net/ubbthreads.php?ubb=showflat&Number=142165#Post142165 G 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.