Jump to content

twk

Member
  • Posts

    716
  • Joined

  • Last visited

Everything posted by twk

  1. twk

    Data Tags

    There isn't much script functionality on the DevWiki regarding Data Tags. I was wondering if anyone knew how to get a handle to an object a data tag is attached to. Say I can collect all the data tags in a viewport, as handles, does anyone know how to get handles to objects those data tags are attached to? Cheers, Tui
  2. Havent tested, but you could use the WallFootPrint(WallHandle) function to create a dummy polygon of the outline of the curved wall. And check if that polygon is within LOC, then delete this dummy polygon. May create memory overhead with creating and deleting objects. Again, havent tested.
  3. Is there a command for list of available targe SP's? For the NZ version I had to change target from "SP4" to "MB-SP4" to get the localised SP4 version. This was done through trial and error as MegaBits(MB) is the distributor here.
  4. You edit the titleblock border layout to do this. Maybe this video will help:
  5. ++++ Grid Lines and Elevation Lines to auto-display in viewports.
  6. Good spotting guys. There's no mention of this anywhere on the socials.
  7. Thanks for the help everyone. Much appreciated
  8. Sorry, I totally forgot about this thread. What a shame, that resource was a treasure trove. Yes please @_c_, that would be greatly appreciated.
  9. Swapped out the HScale2D for HScale3D, and seems to scaling fine here. Working on Extrudes though. What particular 3D objects where you trying to scale? # DISCLAIMER # - Python Novice # - Script presented as is # - save your work before using # - use at your own risk # - no responsibilty taken for damage to your property from the use of this script # - copyright twk 2016 # - forum link = https://forum.vectorworks.net/index.php?/topic/19675-how-can-i-scale-multiple-objects-from-each-objects-center/ # - Tested on Windows 10 x64, Vectorworks 2016 SP4 def List_SelectedObjs_in_Layer(): # small function to store all selected objects on the current layer into a usable list (python list) h_FirstInContainer = vs.FIn3D(vs.ActLayer()) listObjs_inContainer = [] while (h_FirstInContainer != None): if vs.Selected(h_FirstInContainer): listObjs_inContainer.append(h_FirstInContainer) h_FirstInContainer = vs.NextObj(h_FirstInContainer) return listObjs_inContainer list_selObjs = List_SelectedObjs_in_Layer() # function called, selected objects stored countIt = len(list_selObjs) # number of selected objs store in countIt variable if countIt > 0: # checking to make sure at least 1 or more objects are selected scaleAmount = vs.RealDialog("Enter Scale Amount", "1.5") if not vs.DidCancel(): # checking to make sure predefined Dialog's OK button was pressed for eachObj in list_selObjs: center = vs.HCenter(eachObj) # getting center of obj to be used in next function # vs.HScale2D(eachObj,center[0],center[1],scaleAmount, scaleAmount, True) vs.HScale3D(eachObj, center[0], center[1], 0, scaleAmount, scaleAmount, scaleAmount) vs.ReDrawAll() # redraw-ing the screen as is needed after running HScale2D vs.AlrtDialog("{} Objs scaled".format(countIt)) #indicates the number of objects scaled else: vs.AlrtDialog("At least 1 object must be selected") # checking to make sure at least 1 or more objects are selected
  10. Oh ok, we don't have SP4 version for New Zealand yet. On another note, I'm wondering how the script works even though the vs.PushAttrs and vs.PopAttrs are syntactically incorrect. They should have parenthesis' -> vs.PushAttrs() and vs.PopAttrs()
  11. Tried in VW2018 SP6 and VW2019 SP3, there are no instances of the error you showed in the video.
  12. Any chance of a code snippet you can provide?
  13. Oh I was just diving into the world Listbrowser(s). It's down again.. any reason @Matt Panzer this can't be hosted on the Dev Wiki?
  14. the vs.AddSurface result is either a handle if surfaces overlap, or None/0 if the added surfaces don't overlap. I provided error checking on line: if add not in [0, None]:
  15. 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:])
  16. 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?
  17. Below is a video of the new engine. Even though I'm a Lumion user, this looks pretty impressive.
  18. 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
  19. 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!
  20. 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
  21. 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)
  22. 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)
  23. 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
×
×
  • Create New...