Popular Post The Hamma Posted May 16, 2020 Popular Post Share Posted May 16, 2020 (edited) Revised 08-13-2020 See revision note in new comments Revised 03-30-2022 Download lasted versions at bottom of thread Attached are scripts that I wrote to help with renovation projects. These scripts edit the classing and add a construction phase record to every item selected. PIO's that are inserted in walls can be selected with out selecting the containing wall and the script will only affect those PIO's selected. If the wall is selected it will modify the wall and the PIO's that are contained with in that wall. SCRIPT CLASS MODIFICATION CONSTRUCTION PHASE RECORD 1 Existing Object 1_Exist- (Prefix) EXISTING TO REMAIN 2 Demo Object 2_Demo- (Prefix) DEMOLISH EXISTING 3 New Object No change or return to original Class NEW CONSTRUCTION 4 NIC Object No change or return to original Class NOT IN CONTRACT 5 Remove Phase Record No change or return to original Class REMOVES RECORD FROM SELECTED OBJECTS (ADDED) With the use of the scripts and data visualization you can create viewports that show the construction phases as desired. Attached to this post is a demonstration Video, the two files used in that video, and the four scripts. I added the script to my selected object context menu so when I right click on an object I can access the scripts from there. 2020-05-16 16-42-33.mp4 Construction Phase Demo Unmodified Plan.vwx Construction Phase Demo.vwx Edited March 30, 2022 by The Hamma 5 1 Quote Link to comment
The Hamma Posted July 13, 2020 Author Share Posted July 13, 2020 (edited) Script has been modified to detect if Design Layers or Sheet Layer is active and Isolate modifications to the active layer type. Also added the ability to modify objects within a Sheet Layer or Sheet Layer VP annotations. Note that classes will need to be enabled in VP dialog after running script in VP annotations otherwise they may be hidden. Only works on objects inserted in walls when design layer is active. """ This script assigns selected objects to class "1_Exist-(original class)" and set Construction Phase to 'EXISTING TO REMAIN'. If a in wall object is selected without selecting the wall the script will only change those in wall objects. If a wall is selected it will change the wall and all objects inserted in that wall. If New class does not exist objects original class is duplicated to retain class attributes. To take full advantage of this script use "Data Visualization" to display the "Construction Phase" record objects as desired. 1. Set "Data Visualization" to modify drawings per "Construction Phase" record 2. To make a "Construction Phase" invisible set the attributes of that phase to: Line settings to Fill "Solid White" and Line weight "0" This Python Script may be freely distributed. No warranty provided. Use at your own risk. Vectorworks bug does not show changes to symbols inserted in wall until either: Drawing is saved and reopened. Setting in Data Visualization dialog is changed. Symbol is removed from wall, can then be reinserted David Hamer, 2020 revision 07-15-2020 """ # Modifications to any objects happen here def assign(h): CName = vs.GetClass(h) CLen = vs.Len(CName) CNameE = vs.Copy(CName, 1, 8) # Grab First 8 letters of handle's class CNameD = vs.Copy(CName, 1, 7) # Grab First 7 letters of handle's class if CNameD == '2_Demo-': # Check if first 7 letters equal '2_Demo-' CName = vs.Copy(CName, 8, CLen) # if true grab root name of class # check if the class is new, if so delete new class and duplicate objects class and rename. if CNameE == '1_Exist-': CNameN = CName else: CNameN = vs.Concat('1_Exist-', CName) # If not add '1_Exist-' to name ClassCount = vs.ClassNum() # determine number of classes in drawing vs.NameClass(CNameN) # set the name of the class to be applied to handle if new class will be created if ClassCount + 1 == vs.ClassNum(): # check if the class is new and if delete new class and duplicate source vs.ReDraw() vs.DelClass(CNameN) # Delete new class CHandle = vs.GetObject(CName) # get handle to source class NDCHandle = vs.CreateDuplicateObject(CHandle, vs.GetParent(CHandle)) # duplicate source class vs.SetName(NDCHandle, CNameN) # rename duplicate class to name to be applied to handle vs.ResetObject(NDCHandle) vs.ResetObject(h) vs.SetClass(h, CNameN) # name handle's class vs.SetRecord(h, 'Construction Phase') # add record to inserted object vs.SetRField(h, 'Construction Phase', 'Phase', 'EXISTING TO REMAIN') # modify record to inserted object # Passes Handle to "def assign(h):" of PIO or Symbol selected def pio_processing(h): global container # declare global variable to be retained if vs.GetObjectVariableInt(vs.GetLayer(h), 154) == activetype: assign(h) # Runs "def assign(h):" hParent = vs.GetParent(h) # Get Parent handle itParent = vs.GetTypeN(hParent) # Get Parent type if itParent != []: if itParent == 68: # If Parent type is a wall set container to state PIOinwallwasdetected container = 'PIOinwallwasdetected' if itParent == 89: # If Parent type is a round wall set container to state PIOinwallwasdetected container = 'PIOinwallwasdetected' # Passes Handle to "def assign(h):" of every object except PIO and Symbols outside walls selected def object_processing(h): if vs.GetObjectVariableInt(vs.GetLayer(h), 154) == activetype: assign(h) # Runs "def assign(h):" h1 = vs.FIn3D(h) while h1 != []: if vs.GetObjectVariableInt(vs.GetLayer(h1), 154) == activetype: if vs.GetTypeN(h1) == 15: assign(h1) # Runs "def assign(h):" on symbol inserted if vs.GetTypeN(h1) == 86: assign(h1) # Runs "def assign(h):" on PIO inserted h1 = vs.NextObj(h1) def sl_processing(h): # Omit's Viewports in Sheet Layers if vs.GetTypeN(h) != 122: assign(h) activetype = 1 container = 'none' # Declare container var ACName = vs.ActiveClass() # Record name of active class if vs.GetObject('Construction Phase') == (): # Creates "Construction Phase" record if not present vs.NewField('Construction Phase', 'Phase', '<none>', 4, 0) if vs.GetObjectVariableInt(vs.ActLayer(), 154) == 2: activetype = 2 vs.ForEachObjectInLayer(sl_processing, 2, 0, 0) else: # Passes Handle to "def pio_processing(h):" of PIO and Symbols selected vs.ForEachObject(pio_processing, "((((T=PLUGINOBJECT)|(T=SYMBOL)) & (V) & (SEL=TRUE)))") # Passes Handle to "def object_processing(h):" of objects selected except PIO and Symbols outside walls selected # Skipped if PIO or Symbol selected was in wall if container != 'PIOinwallwasdetected': vs.ForEachObject(object_processing, "(((T<>PLUGINOBJECT)&(T<>SYMBOL)&(T<>VIEWPORT) & (V) & (VSEL=TRUE)))") vs.NameClass(ACName) # Return active class Edited July 15, 2020 by The Hamma Quote Link to comment
The Hamma Posted August 13, 2020 Author Share Posted August 13, 2020 (edited) Script has been edited to omit objects selected on layers that are visible but not editable because layer options are not set to "Show/Snap/Modify Others" """ This script assigns selected objects to class "1_Exist-(original class)" and set Construction Phase to 'EXISTING TO REMAIN'. If a in wall object is selected without selecting the wall the script will only change those in wall objects. If a wall is selected it will change the wall and all objects inserted in that wall. If New class does not exist objects original class is duplicated to retain class attributes. To take full advantage of this script use "Data Visualization" to display the "Construction Phase" record objects as desired. 1. Set "Data Visualization" to modify drawings per "Construction Phase" record 2. To make a "Construction Phase" invisible set the attributes of that phase to: Line settings to Fill "Solid White" and Line weight "0" This Python Script may be freely distributed. No warranty provided. Use at your own risk. Vectorworks bug does not show changes to symbols inserted in wall until either: Drawing is saved and reopened. Setting in Data Visualization dialog is changed. Symbol is removed from wall, can then be reinserted David Hamer, 2020 revision 08-13-2020 """ # Modifications to any objects happen here def assign(h): CName = vs.GetClass(h) CLen = vs.Len(CName) CNameE = vs.Copy(CName, 1, 8) # Grab First 8 letters of handle's class CNameD = vs.Copy(CName, 1, 7) # Grab First 7 letters of handle's class if CNameD == '2_Demo-': # Check if first 7 letters equal '2_Demo-' CName = vs.Copy(CName, 8, CLen) # if true grab root name of class # check if the class is new, if so delete new class and duplicate objects class and rename. if CNameE == '1_Exist-': CNameN = CName else: CNameN = vs.Concat('1_Exist-', CName) # If not add '1_Exist-' to name ClassCount = vs.ClassNum() # determine number of classes in drawing vs.NameClass(CNameN) # set the name of the class to be applied to handle if new class will be created if ClassCount + 1 == vs.ClassNum(): # check if the class is new and if delete new class and duplicate source vs.ReDraw() vs.DelClass(CNameN) # Delete new class CHandle = vs.GetObject(CName) # get handle to source class NDCHandle = vs.CreateDuplicateObject(CHandle, vs.GetParent(CHandle)) # duplicate source class vs.SetName(NDCHandle, CNameN) # rename duplicate class to name to be applied to handle vs.ResetObject(NDCHandle) vs.ResetObject(h) vs.SetClass(h, CNameN) # name handle's class vs.SetRecord(h, 'Construction Phase') # add record to inserted object vs.SetRField(h, 'Construction Phase', 'Phase', 'EXISTING TO REMAIN') # modify record to inserted object # Passes Handle to "def assign(h):" of PIO or Symbol selected def pio_processing(h): global container # declare global variable to be retained if vs.GetObjectVariableInt(vs.GetLayer(h), 154) == activetype: hSEL.append(h) # adds to list hParent = vs.GetParent(h) # Get Parent handle itParent = vs.GetTypeN(hParent) # Get Parent type if itParent != []: if itParent == 68: # If Parent type is a wall set container to state PIOinwallwasdetected container = 'PIOinwallwasdetected' if itParent == 89: # If Parent type is a round wall set container to state PIOinwallwasdetected container = 'PIOinwallwasdetected' # Passes Handle to "def assign(h):" of every object except PIO and Symbols outside walls selected def object_processing(h): if vs.GetObjectVariableInt(vs.GetLayer(h), 154) == activetype: hSEL.append(h) # adds to list h1 = vs.FIn3D(h) while h1 != []: if vs.GetObjectVariableInt(vs.GetLayer(h1), 154) == activetype: if vs.GetTypeN(h1) == 15: hSEL.append(h1) # adds to list if vs.GetTypeN(h1) == 86: hSEL.append(h1) # adds to list h1 = vs.NextObj(h1) def sl_processing(h): # Omit's Viewports in Sheet Layers if vs.GetTypeN(h) != 122: assign(h) hSEL = [] # defines list to contain handles to all selected objects activetype = 1 container = 'none' # Declare container var ACName = vs.ActiveClass() # Record name of active class if vs.GetObject('Construction Phase') == (): # Creates "Construction Phase" record if not present vs.NewField('Construction Phase', 'Phase', '<none>', 4, 0) if vs.GetObjectVariableInt(vs.ActLayer(), 154) == 2: activetype = 2 vs.ForEachObjectInLayer(sl_processing, 2, 0, 0) else: # Passes Handle to "def pio_processing(h):" of PIO and Symbols selected vs.ForEachObject(pio_processing, "((((T=PLUGINOBJECT)|(T=SYMBOL)) & (V) & (SEL=TRUE)))") # Passes Handle to "def object_processing(h):" of objects selected except PIO and Symbols outside walls selected # Skipped if PIO or Symbol selected was in wall if container != 'PIOinwallwasdetected': vs.ForEachObject(object_processing, "(((T<>PLUGINOBJECT)&(T<>SYMBOL)&(T<>VIEWPORT) & (V) & (VSEL=TRUE)))") for h in hSEL: if vs.GetPrefInt(506) != 5: if vs.GetLayer(h) == vs.ActLayer(): assign(h) else: assign(h) vs.NameClass(ACName) # Return active class Edited August 13, 2020 by The Hamma Quote Link to comment
Mi&D Posted March 19, 2021 Share Posted March 19, 2021 @The Hamma Hello I am a Swiss VW-User. I do appreciate your shared work. Since I don't have any idea about scripting, I admire those who have these skills. Could I kindly ask an information?: Why does Data -Visualization of walls not work in section? Hatch patterns do not show up the way they do in floor plans... A door instead does appear correctly in floor and section... What is the difference between a wall and a door regarding data visualization? Quote Link to comment
Pat Stanford Posted March 19, 2021 Share Posted March 19, 2021 VW uses a concept of "Hybrid Objects" to allow to allow a single object in the drawing to display differently in a Top/Plan view than in any other view. Think about a door inserted in a wall. The Top/Plan ("screen plane" or 2D) representation of the object will show the door swing. In other views (and sections) you will get the "model" (3D) version of the object. Since Sections are not Top/Plan view, they are going to display differently. 3D only object show as wireframe only when displayed in Top/Plan view. You can make Symbols and manually add the screen plane objects to make the Top/Plan view display what you want, or you can use the Autohybrid command to automatically take a 3D object and add a Top/Plan version to it. Quote Link to comment
The Hamma Posted March 19, 2021 Author Share Posted March 19, 2021 (edited) Pat answered the question well. You can combat this with class settings and possibly layering viewports. I would recommend watching the RENDERING FOR EVERYDAY ARCHITECTURAL DRAWING course. Also I have revised by scripts and they are below. A word of caution they use a different record. I revised the record to be "Status and Phase" to be more inline with the way others were using the terminology. I also added records for demolition and new construction notes. I would recommend not converting to the new format on an existing drawing because the new scripts do not work with the older data visualizations that I provided in the first files. But if you do want to I have written another script to convert a drawing using the old script to the new scripts. script = "Convert to new Status and Phase record script from old Record" You have to import the "Status and Phase" record into the old drawing before running the conversion script. It will convert everything with out selection. All of my Python Scripts may be freely distributed. No warranty provided. Use at your own risk. (Download newest versions below) Once you replace the scripts in you plugin folder the old record format will not work. Adding notes to the record you can use data tags to show the notes Edited March 30, 2022 by The Hamma 1 Quote Link to comment
Mi&D Posted March 19, 2021 Share Posted March 19, 2021 @Pat Stanford Hello Pat! Thanks for your explanation. I do now better understand. I do also appreciate your recommendation to use Autohybrid objects and symbols. Isn't there any possibility to "manipulate" the hatch fillings of walls so that they appear different in section? Quote Link to comment
Mi&D Posted March 19, 2021 Share Posted March 19, 2021 @The Hamma Great - Thank you for your recommendation. I'll watch the course. So far I haven't any existing drawings to convert... I'll study your scripts as you provided them. It should be possible for me changing the colors of Data Visualization of your template. In Swiss renovation projects colors are: red for new construction yellow for demolition black for existing to remain. Quote Link to comment
The Hamma Posted March 19, 2021 Author Share Posted March 19, 2021 2 hours ago, Mi&D said: It should be possible for me changing the colors of Data Visualization of your template. Yes, just modify the Data Visualization settings. Quote Link to comment
Mi&D Posted March 22, 2021 Share Posted March 22, 2021 @The Hamma Hello I've started the RENDERING FOR EVERYDAY ARCHITECTURAL DRAWING course. It's very interesting for me. Thanks again. I've already noticed one particular thing concerning walls and their behavior in floor and section. As Wes Gardner explains walls consist of a Container Class and of Component classes. In floor plans it is possible to turn off the Component class, to show only outlines. We can even change the filling of the containerr class from solid white to solid black in wall attributes. If I try to do the same in section - say I turn of the component class of walls - the walls will completely disappear... Isn't there a way to make section work the same way as floor plans? Quote Link to comment
The Hamma Posted March 22, 2021 Author Share Posted March 22, 2021 7 hours ago, Mi&D said: Isn't there a way to make section work the same way as floor plans? Not to my knowledge. Sections are a bit difficult to work with sometimes. I have not had a lot of experience with the section viewports. Quote Link to comment
Mi&D Posted March 23, 2021 Share Posted March 23, 2021 hi. During research I've found the this thread... Started playing around with the "test File". Wouldn't it be possible to use the new 2021 Materials for renovation projects? Say we have one Material for each phase: Existing / Demolish / New By overriding the fill attributes of Materials in Data Visualization, we get the same result in Floor and Section... Am I right? Quote Link to comment
Mi&D Posted March 23, 2021 Share Posted March 23, 2021 (edited) I think I've missed one thing: It is necessary to combine Status/Phase database with the Materials. I don't see the solution yet... P.S.: I've noticed that you are using scripts for the phasing. I don't know scripting. I did use data base instead. See attached image... Either way, there should be a way to get the proper presentation for renovation plans in section. Edited March 23, 2021 by Mi&D Quote Link to comment
Mi&D Posted March 24, 2021 Share Posted March 24, 2021 @Pat Stanford & @The Hamma Hi I'm still struggling with Data Visualization for renovation. At the moment I'm trying it with multiple Data visualization. I managed to override "data base - entries" in floor plans, and "2021 materials" in section. This gives me a better result. But still there are issues with doors and windows. They do not take over the colors of corresponding walls. As you see in the attachment the wing of doors are black, while the door case has the override-color of the wall... There is also a problem with windows in floor plan: Some are "covered" by the solid fill of the wall, while others appear correctly. For better understanding I attach the file. Could I ask you for help to solve the problem with doors and windoows? Also, I feel like in VW 2021 help, there isn't much explanation about multiple Data visualization... Is there any tutorial about this topic? kind regards Michael Multiple Data visualization_Renovation.vwx Quote Link to comment
The Hamma Posted March 24, 2021 Author Share Posted March 24, 2021 I recommend using classes to define the data visualization of the doors and window in sections. See attached. Multiple Data visualization_Renovation.vwx Quote Link to comment
Mi&D Posted March 25, 2021 Share Posted March 25, 2021 Great! Thanks for your suggestion... I got it. I'll try to keep up in my actual renovation project using this method. Quote Link to comment
Mi&D Posted March 26, 2021 Share Posted March 26, 2021 Hi What works for the doors doesn't work the same for windows. I tried the same procedure on Windows but there is no result. See Appendix...(*.jpg and *.vwx) Even though the window in the red wall has the same class as the door, its color does not change. There is also a difference in reveals between windows and doors. I couldn't find any solution yet... Could I ask you, if you have any idea on how to change window settings through data visualization? Multiple Data visualization_Renovation windows.vwx Quote Link to comment
The Hamma Posted March 26, 2021 Author Share Posted March 26, 2021 (edited) This is what I get when I open the document. Try closing and reopening the document. or restarting vectorworks or your computer Also about the reveals. The door appears to have some sort of header. It won't let me edit your door object. Edited March 26, 2021 by The Hamma Quote Link to comment
Mi&D Posted March 26, 2021 Share Posted March 26, 2021 (edited) Hi As far as I remember, the window tool in your version (I guess it's the version of the US) is different from the Swiss one. This might be the reason why it isn't possible to edit those objects. See this link from our Swiss Forum... Down below I translated the essence for you... Anyways, I need to understand how the attributes of windows work, only then I can try to change them with data visualization. But please, if you could try in your VW version, to insert a window in a wall and see what it gives after applying data visualization, the same way you did with the doors before (Doors Demo). I should be really thankful for this. 3 hours ago, The Hamma said: The door appears to have some sort of header. The highlighted object on the printscreen you've sent me is not a door, but a window. The header show levels of parapet and lintel. Here now the translation of the thread: Das Fenstertool ist beispielsweise wie @zoom schon aufführt komplett anders. (Das engl. Window Tool ist auch in der DE Version enthalten.) For example, the window tool is completely different, as @zoom already performs. (The English Window Tool is also included in the DE version.) D-A-CH Fenster: Germany, Austria, Switzerland Window: US Fenster: US Window: Ich kenne die US Version zwar viel zu wenig, aber gefühlt ist die DE Version schon weit umfangreicher, vor allem was Anschläge, Leibungsausbildung, Fenstereinteilungen und auch die Plandarstellung angeht. I know the US version far too little, but it seems like the Swiss version is more extensive, especially in terms of hinges, reveals, window layouts. Es gibt auch noch die Benelux Version 😏, die kann dann noch viel mehr bei den Fensterformen (Freiformen). There is also the Benelux version 😏, which can then do much more with the window shapes (freeforming). Edited March 26, 2021 by Mi&D Quote Link to comment
The Hamma Posted February 11, 2022 Author Share Posted February 11, 2022 My current Record and Scripts. 1 Existing Object.vsm2 Demo Object.vsm3 New Object_Class.vsm4 NIC Object.vsm5 Remove Phase Record.vsm6 New Object.vsm7 Add Phase Record.vsm8-Phase 1.vsm9-Phase 2.vsmRelocate Existing.vsm Status Phase.vwx Quote Link to comment
Jiajing Posted January 6, 2023 Share Posted January 6, 2023 Is there a way I can check if Data Viz is active in doc and if it doesn't, make it active? @The Hamma @Pat Stanford Quote Link to comment
Pat Stanford Posted January 6, 2023 Share Posted January 6, 2023 I don't believe as of VW2023 that there is any way to script Data Visualizations. 😞 Quote Link to comment
Jiajing Posted January 6, 2023 Share Posted January 6, 2023 Even just check if a data viz exsit or not? @Pat Stanford Quote Link to comment
Pat Stanford Posted January 6, 2023 Share Posted January 6, 2023 As I said, I don't think there is ANY ability to script Data Viz at least through VW2023. 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.