Jump to content

twk

Member
  • Posts

    732
  • Joined

  • Last visited

Everything posted by twk

  1. Got it to work! # Disclaimer: no responsibility taken for data loss. Code responsibly, save often. def addsurface_from_list(objs_list:list): # where objs_list is a list of object handles of rectangle/polygon/arc/etc.. if len(objs_list) > 0: fobj = objs_list[0] for o in objs_list[1:]: add = vs.AddSurface(fobj, o) if add not in [0, None]: objs_list.remove(o) objs_list.append(add) break addsurface_from_list(objs_list[1:])
  2. The Addsurface function only takes in two handles. How would you do a list of handles? As per screenshot below: where some rectangles are overlapping and some aren't? using Addsurface in a for loop seems impossible as once the surfaces are added h1, h2 are deleted. Thoughts anyone?
  3. Below is a video of the new engine. Even though I'm a Lumion user, this looks pretty impressive.
  4. I've never been able to get this to work, do you have a short step-by-step description of how you've gotthen the ODBC to work? -- edit -- BTW, I use to the openpyxl python module to talk between vectorworks and excel. If only there were better documentation on the external databases connection process for VW Cheers, Tui
  5. Wow... was not expecting this at all!?... Vectorworks' loss for sure! In any case, you have set the standard for customer/user support for any company. All the best in your future endeavors!
  6. If you're looking for viewport class visibilities, they're under the 'Group' category in the DevWiki. http://developer.vectorworks.net/index.php/Category:VS_Function_Reference:Objects_-_Groups They have viewport layer visibility getters and setters there as well. Cheers, Tui
  7. Heres another one that lists them all in one text object, adding the option to show the stacking order number with it or not. -- Save your work before using -- get_layer_type = lambda x:vs.GetObjectVariableInt(x, 154) # 1 = Design Layer, 2 = Sheet Layer, 3 = Referenced Layer get_layer_type_switch = 0 #Custom switch, change to get different layer types 0=Design Layers Only, 1=Sheet Layers Only, 2=Both Design Layers and Sheet Layers show_stacking_order = False #Set to True if you want the string to show the stacking order number beside it font_size = 10 layer_names = [] hLayer = vs.FLayer() while hLayer != None: layer_type = get_layer_type(hLayer) if get_layer_type_switch == 0: if layer_type == 1: layer_names.append(vs.GetLName(hLayer)) elif get_layer_type_switch == 1: if layer_type == 2: layer_names.append(vs.GetLName(hLayer)) elif get_layer_type_switch == 2: layer_names.append(vs.GetLName(hLayer)) hLayer = vs.NextLayer(hLayer) # we now reverse sort the layer_names list. For some reason this method retrieves layers in reverse order of the stack shown in the Navigation Pallette. layer_names.reverse() text_str = "\r".join([str(x) for x in layer_names]) if show_stacking_order: text_str = "\r".join(["[{}] {}".format(i, x) for i,x in enumerate(layer_names)]) vs.CreateText(text_str) TEXT = vs.LNewObj() vs.SetTextVerticalAlign(TEXT,3) vs.SetTextJust(TEXT, 1) vs.SetTextSize(TEXT, 0, len(vs.GetText(TEXT)), font_size)
  8. Swap out integers for the get_layer_type_switch, to retrieve a list of either Design Layers, Sheet Layers or Both. -- Save your work before using -- get_layer_type = lambda x:vs.GetObjectVariableInt(x, 154) # 1 = Design Layer, 2 = Sheet Layer, 3 = Referenced Layer get_layer_type_switch = 0 #Custom switch, change to get different layer types 0=Design Layers Only, 1=Sheet Layers Only, 2=Both Design Layers and Sheet Layers layer_scale = vs.GetLScale(vs.ActLayer()) # page mm scale 1:1 spacing = 3 * layer_scale font_size = 10 layer_names = [] hLayer = vs.FLayer() while hLayer != None: layer_type = get_layer_type(hLayer) if get_layer_type_switch == 0: if layer_type == 1: layer_names.append(vs.GetLName(hLayer)) elif get_layer_type_switch == 1: if layer_type == 2: layer_names.append(vs.GetLName(hLayer)) elif get_layer_type_switch == 2: layer_names.append(vs.GetLName(hLayer)) hLayer = vs.NextLayer(hLayer) # we now reverse sort the layer_names list. For some reason this method retrieves layers in reverse order of the stack shown in the Navigation Pallette. layer_names.reverse() text_objects = [] for layer_name in layer_names: vs.CreateText(layer_name) TEXT = vs.LNewObj() # set text vertical align and horizontal align = center, left vs.SetTextVerticalAlign(TEXT, 3) vs.SetTextJust(TEXT, 1) vs.SetTextSize(TEXT, 0, len(layer_name), font_size) text_objects.append(TEXT) for i, text in enumerate(text_objects): if i != 0: prev_text = text_objects[i-1] prev_text_bbox = vs.GetBBox(prev_text) vs.HMove(text,0,(prev_text_bbox[1][1])-spacing)
  9. Hi @John Meunier, Looks like a glitch in the matrix.. - Any other formula added to that glitching cell doesn't work. - If I copy the formula out, then replace it with the cell's formula next to it. The worksheet starts to function again. - Now I can copy back in the first formula I had (or you wrote), and it recalculates fine. 2019-03-14_13-24-08.mp4
  10. There is no native way to do it. But you could with a script. 1. Create a script in your file name it 'WS_ALL_CAPS' . (When it asks you to create a palette, just name the palette whatever you want, something like 'WS Scripts' will suffice. 2. When the script dialog box pops up, change the language to Python. 3. Use the code below in your script: orignal_str = vs.WSScript_GetPrmStr(0) vs.WSScript_SetResStr(orignal_str.upper()) 4. Now back in your worksheet, select the cell you want capitalized. Enter this into the formula bar: =RUNSCRIPT('WS_ALL_CAPS', 'Existing Tree'.'ActionComment') 5. Recalculate Active Worksheet
  11. Just as a follow up to my previous post being for a 3rd party Addon to Archicad, the actual native Handrail tool in Archicad is something to be envious of as well..
  12. Pretty amazing what these guys are doing. https://twitter.com/Test_Fit_io
  13. I remember seeing the 2016 Marionette video about cladding walls.. looked so promising, until I tried it myself. Short answer : a short endeavor..
  14. Oh you definatley should check out @JRA-Vectorworks-CAD's work. Youtube channel here: https://www.youtube.com/channel/UC56qp6QeXSAayDOOHu3BcCA
  15. After extruding a circle, you can user-adjust position of top or bottom end of cylinder by activating the "ReShape" Tool command. (highlighted tool in screenshot below)
  16. Wondering how 2019 does it with titleblock data being able to read TB info from another file? Could not find any related functions for opening one file in another file in the DevWiki or the SDK files.
  17. Greetings and happy new year all, I was wondering if there was anyway to access plugin data from a file other than the active one? Wanting to read in data from a plugin object that resides in another file. Cheers, Tui
  18. This I can relate to.. on the other hand, surley Teamviewer sessions with Vectorworks Tech support would be much faster/cheaper/easier then bug submissions/phone calls/site visits? I should probably wishlist this..
  19. Is there a maximum number of layers you can map onto an IFC Story? See GIF below: I can't attach those last few layers to the IFC story. Also is there any way to export these settings? When we click save setting where does it get saved to?
  20. Here I created a custom object class: (tested and worked in VW2016) # save work before using 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(handle_to_group)) # See Documentation for parameter descriptions vs.SetClass(handle_to_group,className) # Set Class of overall group for object in stored_objects: object.restore_old_class() else: vs.SetClass(handle_to_group, className) # Set Class of overall group vs.ReDrawAll() # Sometimes my machine needs this to show updated attributes vs.ResetObject(handle_to_group) # Updates Object Info Pallette h = vs.FSActLayer() SetClassGroup_Contents(h,'NewClass1') # Use for apply to group only # SetClassGroup_Contents(h,'NEW CLASS', True) # Use for apply to group and contents
  21. Ok, reporting back, I dont have access to 2014/2015 anymore, but I have just tried in 2016 and it doesnt do what i thought it did. The class function gets set to both the group and the objects in it. Im stumped.
  22. until

    Missed this! Any chance for a recording for this please! Checked the service select portal theres nothing on there for this.
  23. To my understanding it has been fixed as of 2019
  24. Raymond you are correct. I have just tried in 2017. I will check another machine that has 2014/2015/2016 installed. I've used it before in plugin objects. I wonder what changed. BTW this works in 2018. Shall report back with findings..
  25. Not sure if I'm following these correctly, but are you trying to create a function that sets the class of a group together with its contents? here's a custom function I created prior to 2018, def SetClassGroup_Contents(handle_to_group, className:str, descend=False): if vs.GetTypeN(handle_to_group) == 11: # Only work on groups TypeGroup == 11 if descend: # if descend parameter set then cycle through each item in group, default is set to false def set_class_objs_in_group(h): vs.SetClass(h,className) vs.ForEachObjectInList(set_class_objs_in_group,0,1,vs.FInGroup(handle_to_group)) # See Documentation for parameter descriptions vs.SetClass(handle_to_group,className) # Set Class of overall group vs.ReDrawAll() # Sometimes my machine needs this to show updated attributes vs.ResetObject(handle_to_group) # Updates Object Info Pallette h = vs.FSActLayer() SetClassGroup_Contents(h,'NEW CLASS') # Use for apply to group only SetClassGroup_Contents(h,'NEW CLASS', True) # Use for apply to group and contents I guess you could then use this on ForEachObject call for all the groups you've found. criteria = "(T=GROUP)" def apply_class(h): classNew = "NEW CLASS" SetClassGroup_Contents(h,classNew,True) vs.ForEachObject(apply_class,criteria) Also, I've never come across call vs.Layer('Design Layer-1') creating another 'Design Layer-2' layer. This has never happened to me. I use the vs.Layer() call all the time, especially in Project Sharing files HTH, Tui
×
×
  • Create New...