Jump to content

The Hamma

Member
  • Posts

    360
  • Joined

  • Last visited

Everything posted by The Hamma

  1. Is there a vectorscript command to create new space style from current space handle?
  2. The current options in "Draw All Other Objects" are "Normally" and "Grayed". I would like "Hidden" to be added to those options so that objects not modified by Data Visualization properties would not display in the selected Data Visualization.
  3. I would like to request that a "Hidden" option is added to "Data Visualization" to the "Draw All Other Objects" Options
  4. I am looking for the files to modify for Standard Naming. For example the User 3 profile. Does anyone know where they are located or what the name of the file is?
  5. Marissa: I understand why you collected the handles of the Viewports before processing the actions but I was wondering why you collected the handles of the drawing labels before not deleting them. Would it be more efficient code to delete objects as you detect them?
  6. Does anyone know if it is possible to define a class tag using vectorscript?
  7. Below are the final results: Three scripts to assigns selected objects to class "1_Exist-(original class)", "2_Demo-(original class)" , or original class and set Construction Phase Existing, Demo, or New """ This script assigns selected objects to class "1_Exist-(original class)" and set Construction Phase to Existing. 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 """ # 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') # 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 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): assign(h) # Runs "def assign(h):" h1 = vs.FIn3D(h) while h1 != (): 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) 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) # 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) & (V) & (SEL=TRUE)))") vs.NameClass(ACName) # Return active class """ This script assigns selected objects to class "2_Demo-(original class)" and set Construction Phase to Demo. 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 """ # 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 CNameE == '1_Exist-': # Check if first 8 letters equal '1_Exist-' CName = vs.Copy(CName, 9, CLen) # if true grab root name of class if CNameD == '2_Demo-': # Check if first 7 letters equal '2_Demo-' if so retain name CNameN = CName else: CNameN = vs.Concat('2_Demo-', CName) # If not add '2_Demo-' 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', 'Demo') # 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 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): assign(h) # Runs "def assign(h):" h1 = vs.FIn3D(h) while h1 != (): 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) 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) # 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) & (V) & (SEL=TRUE)))") vs.NameClass(ACName) # Return active class """ This script assigns selected objects to class "(original class)" and set Construction Phase to New 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 """ #Modifications to any objects happen here def assign(h): CName=vs.GetClass(h) CLen=vs.Len(CName) CNameN = 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-' CNameN=vs.Copy(CName,8,CLen) # if true grab root name of class if CNameE=='1_Exist-': #Check if first 8 letters equal '1_Exist-' CNameN=vs.Copy(CName,9,CLen) # if true grab root name of class 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', 'New') #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 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): assign(h) # Runs "def assign(h):" h1 = vs.FIn3D(h) while h1 != (): 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) 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) # 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) & (V) & (SEL=TRUE)))") vs.NameClass(ACName) # Return active class DataVisualizationsInfo.vwx 1 Existing Object.vsm 2 Demo Object.vsm 3 New Object.vsm
  8. LOL or just change FSActLayer to h. I didn't even stop to think about that. I was assuming that FSActLayer was passing the handle from : def SetAttribute(h): container = 'none' #set global variable phase = 'Demo' def SetPIOAttribute(h): global container #declare global variable to be retained vs.SetRecord(h,'Construction Phase') #add record to inserted object vs.SetRField(h,'Construction Phase','Phase', phase) #modify record to inserted object itChild = vs.GetTypeN(h) #Get Child type (not necessary) hParent = vs.GetParent(h) #Get Parent handle itParent = vs.GetTypeN(hParent) #Get Parent type #If Parent type is a wall set container to state PIOinwallwasdetected if itParent == 68: container = 'PIOinwallwasdetected' #Add and change record of wall and PIO or symbols inserted in wall def SetAttribute(h): vs.SetRecord(h,'Construction Phase') vs.SetRField(h,'Construction Phase','Phase', phase) h1 = vs.FIn3D(h) while h1 != (): if vs.GetTypeN(h1) == 15: vs.SetRecord(h1,'Construction Phase') vs.SetRField(h1,'Construction Phase','Phase', phase) if vs.GetTypeN(h1) == 86: vs.SetRecord(h1,'Construction Phase') vs.SetRField(h1,'Construction Phase','Phase', phase) h1=vs.NextObj(h1) vs.ForEachObject(SetPIOAttribute, "((NOTINDLVP & NOTINREFDLVP & ((PON='Door')|(T=SYMBOL)|(PON='Window')) & (V) & (SEL=TRUE)))") #If PIO was selected and wall was not then container var PIOinwallwasdetected is true then script will end if not then wall was selected and script will continue to def SetAttribute if container != 'PIOinwallwasdetected': vs.ForEachObject(SetAttribute, "((NOTINDLVP & NOTINREFDLVP & (V) & (SEL=TRUE)))")
  9. I thought it was working perfectly but it does if I select one wall at a time. In that instance it will change the wall and all the PIO objects within but If I select several walls it does not edit all of the PIO objects, it only edits the PIO in the first item selected. container = 'none' #set global variable phase = 'Existing' def SetPIOAttribute(h): global container #declare global variable to be retained vs.SetRecord(h,'Construction Phase') #add record to inserted object vs.SetRField(h,'Construction Phase','Phase', phase) #modify record to inserted object itChild = vs.GetTypeN(h) #Get Child type (not necessary) hParent = vs.GetParent(h) #Get Parent handle itParent = vs.GetTypeN(hParent) #Get Parent type #If Parent type is a wall set container to state PIOinwallwasdetected if itParent == 68: container = 'PIOinwallwasdetected' #Add and change record of wall and inserted items (only changes wall at this time) def SetAttribute(h): vs.SetRecord(h,'Construction Phase') vs.SetRField(h,'Construction Phase','Phase', phase) h1 = vs.FIn3D(vs.FSActLayer()) while h1 != (): vs.SetRecord(h1,'Construction Phase') vs.SetRField(h1,'Construction Phase','Phase', phase) h1=vs.NextObj(h1) vs.ForEachObject(SetPIOAttribute, "((NOTINDLVP & NOTINREFDLVP & ((PON='Door')|(T=SYMBOL)|(PON='Window')) & (V) & (SEL=TRUE)))") #If PIO was selected and wall was not then container var PIOinwallwasdetected is true then script will end if not then wall was selected and script will continue to def SetAttribute if container != 'PIOinwallwasdetected': vs.ForEachObject(SetAttribute, "((NOTINDLVP & NOTINREFDLVP & (V) & (SEL=TRUE)))")
  10. Not inserting the symbol in the wall or using PIO seems to be the best course of action. The symbols visualization works fine if is not nested in a wall. If it is nested I can remove it and re-nest it and the visualization works fine. I still think this is a glitch since it just takes some sort of refresh to make it work. That being said vs.redrawall() does not work (it actually causes every item changed not to refresh). For the most part I think I can work around it but it a bit aggravating.
  11. I added your script to mine and it works great but I think I found a Vectorworks bug. This is a view of a wall with objects after running the script on the symbol in the wall. As you can see in the record the phase has been changed to Existing but the appearance still shows as New. Now if I change the Object Criteria in the Data Visualization or close and reopen the drawing the symbol in wall will appear correctly. I have set my graphic settings up and down with no change. PIO object change fine, I only have this issue with symbols in wall and the issue is not isolated to the script. If I change the phase manually I have the same issue. container = 'none' #set global variable phase = 'Existing' def SetPIOAttribute(h): global container #declare global variable to be retained vs.SetRecord(h,'Construction Phase') #add record to inserted object vs.SetRField(h,'Construction Phase','Phase', phase) #modify record to inserted object itChild = vs.GetTypeN(h) #Get Child type (not necessary) hParent = vs.GetParent(h) #Get Parent handle itParent = vs.GetTypeN(hParent) #Get Parent type #If Parent type is a wall set container to state PIOinwallwasdetected if itParent == 68: container = 'PIOinwallwasdetected' #Add and change record of wall and inserted items (only changes wall at this time) def SetAttribute(h): vs.SetRecord(h,'Construction Phase') vs.SetRField(h,'Construction Phase','Phase', phase) vs.ForEachObject(SetPIOAttribute, "((NOTINDLVP & NOTINREFDLVP & ((PON='Door')|(T=SYMBOL)|(PON='Window')) & (V) & (SEL=TRUE)))") #If PIO was selected and wall was not then container var PIOinwallwasdetected is true then script will end if not then wall was selected and script will continue to def SetAttribute if container != 'PIOinwallwasdetected': h1 = vs.FIn3D(vs.FSActLayer()) while h1 != (): if vs.GetTypeN(h1) == 15: vs.SetRecord(h1,'Construction Phase') vs.SetRField(h1,'Construction Phase','Phase', phase) if vs.GetTypeN(h1) == 86: vs.SetRecord(h1,'Construction Phase') vs.SetRField(h1,'Construction Phase','Phase', phase) h1=vs.NextObj(h1) vs.ForEachObject(SetAttribute, "((NOTINDLVP & NOTINREFDLVP & (V) & (SEL=TRUE)))")
  12. I made this script to apply a record to items selected. The goal is the following: If object in wall is selected add and change record to the object in the wall only. (works as designed) If wall is selected add and change record to the wall and all objects inserted in the wall. (Only changes the wall not the inserted objects) #set global variable container = 'none' def SetPIOAttribute(h): global container #declare global variable to be retained vs.SetRecord(h,'Construction Phase') #add record to inserted object vs.SetRField(h,'Construction Phase','Phase','New') #modify record to inserted object itChild = vs.GetTypeN(h) #Get Child type (not necessary) hParent = vs.GetParent(h) #Get Parent handle itParent = vs.GetTypeN(hParent)#Get Parent type if itParent == 68: #If Parent type is a wall set container to state PIOinwallwasdetected container = 'PIOinwallwasdetected' #Add and change record of wall and inserted items (only changes wall at this time) def SetAttribute(h): vs.SetRecord(h,'Construction Phase') vs.SetRField(h,'Construction Phase','Phase','New') vs.ForEachObject(SetPIOAttribute, "((NOTINDLVP & NOTINREFDLVP & ((PON='Door')|(T=SYMBOL)|(PON='Window')) & (V) & (SEL=TRUE)))") #If PIO was selected and wall was not then container var PIOinwallwasdetected is true then script will end if not then wall was selected and script will continue to def SetAttribute if container != 'PIOinwallwasdetected': vs.ForEachObject(SetAttribute, "((NOTINDLVP & NOTINREFDLVP & (V) & (SEL=TRUE)))")
  13. Using part of twk's script I have tried to create a script that will sort sheet layers and their objects classes. The goal is to have all objects in the sheet layer in the following classes Borders, Veiwports, Groups and other objects on sheet layer = 'SheetClass' Viewport Annotations including components of groups with in the annotations = 'Annotations' Drawing Label = 'Drawing Labels' Everything works accept the components of groups within the annotations of a Viewport. Any suggestions? Python Script #collect handles of selected VPs on active layer def GetHandle(h): vs.SetClass(h,'SheetClass') if vs.GetTypeN(h) == 122: if vs.GetParent(h) == vs.ActLayer(): hVP.append(h) hVP = [] vs.ForEachObjectInLayer( GetHandle,0,2,0 ) #Traverse into the annotations group of selected VPs set classes for VP in hVP: anno = vs.GetVPGroup(VP, 2) h = vs.FInGroup(anno) objs = [h] h = vs.NextObj(h) while h != vs.Handle(0): objs.append(h) h = vs.NextObj(h) for obj in objs: if vs.GetObjectVariableString(obj,1166) == 'Drawing Label': vs.SetClass(obj,'Drawing Labels') else: def SetClassGroup_Contents(handle_to_group, className:str, descend=False): class CustomObject(): def __init__(self, handle): self.handle = handle self.__old_class = vs.GetClass(self.handle) @property def old_class(self): return self.__old_class @old_class.setter def old_class(self, value): self.__old_class = value @property def obj_class(self): return vs.GetClass(self.handle) @obj_class.setter def obj_class(self, value): vs.SetClass(self.handle, value) def restore_old_class(self): self.obj_class = self.old_class if vs.GetTypeN(handle_to_group) == 11: # Only work on groups TypeGroup == 11 if not descend: # if descend parameter set then cycle through each item in group, default is set to false stored_objects = [] #type: list[CustomObject] def set_class_objs_in_group(h): stored_objects.append(CustomObject(h)) vs.ForEachObjectInList(set_class_objs_in_group,0,1,vs.FInGroup(obj)) # See Documentation for parameter descriptions vs.SetClass(handle_to_group,'annotation') # Set Class of overall group for object in stored_objects: object.restore_old_class() else: vs.SetClass(obj,'annotation')
  14. Thanks, I tried it but I get stake objects placed not a "PrintLocus" symbol. Am I doing something wrong, do I need to the symbol prior to running the script?
  15. This is better but slower than working with the point cloud. Just need a way to make the points larger scale when zoomed in. They are so small when close they are almost invisible. The 3d loci are distracting because they have 3 lines for each loci.
  16. Often times I run a command and vectorworks takes an exorbitant amount of time to compute. This time I was trying to convert an exterior elevation to lines. It has been running for about an hour now with no progress. There needs to be a way to quit commands without loosing your work. Or just fix vectorworks so it doesn't take so long. I am sure if it used 100% of the CPU's it would be much quicker.
  17. When using the move tool to create duplicates is great but often I forget that I have set the copy to on and increased the number of duplicates. It would be nice if there was one button to reset it to 1 and turn of the duplicate option.
  18. I wish that there was an option to make some objects that are hidden behind other objects to appear in rendered images even if the object it is behind is not transparent. See the attached image. PARTIAL FRAMING MODEL.pdf
  19. Could the "BeginFloor" command be replaced with a simple extrude? If you ungroup the floor, it becomes a floor and a rectangle. At this time the floor can be rendered by setting the correct attributes.
  20. Love the script but I do have a question. Do you know why the countertop does not have the correct texture in VW 2019
  21. This modification corrects the issue but it seems to me that if the points are read from HCenter as inches then they should be passed to RegularPolygon as inches. HCenter(h,Px,Py); RegularPolygon((Px*25.4),(Py*25.4),(9*25.4),6,1);
  22. Yes, I did try adding the unit to the script but that does not work either. The size and the location of the created polygon are still 1/25.4 scaled.
×
×
  • Create New...