Jump to content


  • Content count

  • Joined

  • Last visited

Community Reputation

42 Great


About twk

  • Rank

Personal Information

  • Occupation
    Architectural Designer
  • Homepage
  • Location
    Auckland, New Zealand

Recent Profile Visitors

1,331 profile views
  1. twk

    Creating Sheet Layers

    In the Sheet Layer context, the Sheet Number component, is basically the Layer name. so you'd use: """ Disclaimer: no warranties of any kind, expressed or inclined. Code provided for self-help use only. Save work, save often. Tui W K 2018 """ def list_layers(): # sub_function to retrieve list of layer names in document layer_names = [] hLayer = vs.FLayer() while hLayer != None: layer_names.append(vs.GetLName(hLayer)) hLayer = vs.NextLayer(hLayer) return layer_names # SAFE CHECK: # check if name is in the layer list, # then create new layer if it's not in the list. cur_layer_to_change_name = "SomeCurrentLayerName" #Replace Name of an existing Sheet Number cur_layer_handle = vs.GetLayerByName(cur_layer_to_change_name) newLayerName = "SomeNewName" if newLayerName not in list_layers(): vs.SetName(cur_layer_handle, newLayerName) HTH, Tui
  2. twk

    Creating Sheet Layers

    screenName = "Screen 1" SheetNumber = "01" layerType = 2 layerName = "Module Layout - " + screenName newLayerHandle = vs.CreateLayer(SheetNumber, layerType) # <-- Sheet Number in the Sheet Layer context, confusing I know vs.SetObjectVariableString(newLayerHandle, 159,layerName) # <-- Found on the DevWiki Appendix page. Documentation states Layer Description, which is also misleading, as it is actually the Sheet Layer 'name'
  3. +1 this. We are getting more apartment/terraced housing projects. Having to scroll through a list of sheets of a 6 story apartment(which comprise of 6 overalls plans and 35 individual floor plan types), just to get to the design layer list through the pull down, sure is an unnecessary waste of time. We do have a workaround though: having the navigation palette always open, but I see the benefit with this request. Cheers, Tui
  4. twk

    Extrude Along Path Node

    You could force the parameter? Below is the node with all fields available. Set Fix Profile to True. Disclaimer, I haven't tested this extensively. So use at own risk, save work, etc. #Modified by TWK May 2018 @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): #APPEARANCE #Name this = Marionette.Node( "Path Extrude" ) this.SetDescription('Extrudes a profile along a path') #Input Ports profiles = Marionette.PortIn( vs.Handle(0), 'hProfile' ) profiles.SetDescription('The profile to extrude') paths = Marionette.PortIn( vs.Handle(0), 'hPath' ) paths.SetDescription('The path to extrude along') eapScale = Marionette.PortIn( 1, 'eapScale' ) eapScale.SetDescription('Set scale of the Profile') eapFactor = Marionette.PortIn( 1, 'eapFactor' ) eapFactor.SetDescription('Set Factor?') eapLockProfile = Marionette.PortIn( False, 'eapLockProfile' ) eapLockProfile.SetDescription('Lock Profile') eapFixProfile = Marionette.PortIn( False, 'eapFixProfile' ) eapFixProfile.SetDescription('Fix Profile') #OIP Controls #Output Ports xtrds = Marionette.PortOut('hObj') xtrds.SetDescription('The resulting object') #BEHAVIOR this.SetLinksObjects() savedView = None this.SetInitFunc(Marionette.InitializeView) this.SetFinalFunc(Marionette.RestoreView) def RunNode(self): #inputs prof = self.Params.profiles.value path = self.Params.paths.value scale = self.Params.eapScale.value Factor = self.Params.eapFactor.value LockProfile = self.Params.eapLockProfile.value FixProfile = self.Params.eapFixProfile.value FixProfile = "Yes" if FixProfile else "No" #script if prof != 0 and path != 0: profile = vs.CreateDuplicateObject(prof, vs.Handle(0)) cntr = vs.HCenter(profile) vs.HMove(profile, -cntr[0], -cntr[1]) if vs.GetTypeN(path) is not 111: oldPath = path path = vs.ConvertToNURBS(path, True) vs.Marionette_DisposeObj(oldPath) eap = vs.CreateCustomObjectPath('Extrude Along Path', path, profile) vs.SetObjectVariableBoolean(eap, 1167, True) vs.SetRField(eap, 'Extrude Along Path', 'Scale', str(scale)) vs.SetRField(eap, 'Extrude Along Path', 'Factor', str(Factor)) vs.SetRField(eap, 'Extrude Along Path', 'Lock Profile Plane', str(LockProfile)) vs.SetRField(eap, 'Extrude Along Path', 'Fix Profile', str(FixProfile)) vs.Marionette_DisposeObj(prof) #outputs self.Params.xtrds.value = eap
  5. The updates are awesome, particular, love the feature to check the forum topics I want to see in a single page.
  6. twk

    Worksheets in Python

    http://developer.vectorworks.net/index.php/VS:Function_Reference#Worksheets http://developer.vectorworks.net/index.php/VS:CreateWSImage def vs.CreateWSImage(worksheet, location): return HANDLE from the Dev Wiki. location is 2DPoint location on the drawing. eg: ws_name = "Worksheet-1" # this is an example, replace with name of your worksheet you want placed on your drawing ws_def_handle = vs.GetObject(ws_name) # grab a handle to the worksheet definition in your resource manager location = (0,0) # places center of drawing ws_handle_on_dwg = vs.CreateWSImage(ws_handle, location)
  7. Thanks Jeremy for confirming!
  8. Greetings all, Wondering if I'm the only one facing this problem. The 2D Cut/Fill Area check box for Site Model(s) is not working anymore in 2018. Was working in 2017 (attached video). Posting here to see if no one else has this problem, it could be my file. Cheers, Tui
  9. +1 for this. After 15+ years of using Vectorworks, I have just now delved into the dark world of call-out notes/databases/keynote legends. All went well until I realised you cannot get rid of the period after the keynote label, in the keynote legend. Please, if there's a way, could someone let me know. If not, please add this request to this wishlist item.
  10. twk

    List Browser comprehensive example

    This is great! Thanks for the update..
  11. twk

    Count objects using the record field value

    I haven't tested the code below, but I believe it goes something like that: (You'll have to declare those variables though; ah Vectorscript ) { Orso *********************************************** } { wraps a string in '' } FUNCTION T_Apo(str: STRING): STRING; BEGIN T_Apo := Concat(Chr(39), str, Chr(39)); END; RecordName := 'Group-A' FieldName := 'Mark' FieldValue := '2001' crit := Concat(T_Apo(RecordName),T_Apo('.'),T_Apo(FieldName),'=',T_Apo(FieldValue)) Counter = Count(crit) Message(Concat('Total Count = ',Counter_))
  12. twk

    Count objects using the record field value

    You could convert that 660 line macro in VS to python .. (jokes) When I used to use vectorscript, the VectorLab website was an invaluable resource. Here are two functions by @orso b. schmidthat helped me string together criteria(s): http://www.vectorlab.info/index.php?title=Txt-Braket http://www.vectorlab.info/index.php?title=Txt-Apostrophe
  13. twk

    Count objects using the record field value

    One of the reasons I jumped to learning python was the Criteria String building in vectorscript, proved really difficult for me. try this, in python: RecordName = "Group-A" FieldName = "Mark" FieldValue = "2001" crit = "'{}'.'{}'='{}'".format(RecordName,FieldName,FieldValue) GroupPanelCount = vs.Count(crit) vs.Message("Total Count = {}".format(GroupPanelCount))
  14. Thanks @Hippocode and @BillW. Was just looking through the dev wiki and totally missed that one. Thanks heaps!
  15. Greetings and Happy New Year to you all, Has anyone figured out how to duplicate an object (locus,symbol) along a 2D path, be it a polyline, polygon? Developing a plugin to take a symbol object and have it duplicate along the Plugins 2D path (this being a 2D poly path plugin object type). Have tried the : def vs.GetPointAndParameterOnNurbsCurveAtGivenLength(inNurbCurve, inPercentOfLength): return (BOOLEAN, p, outParam, outIndex) by converting the 2D path to a nurbs object, running the calc, then copying the /out/ data to the 2D path poly. However just realised the convert to Nurbs command takes into account the orientation of the view. This makes it not feasible for a path-pio object. Any ideas? Cheers, Tui