Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by twk

  1. Thank you very much @Gelde-Aart. As usual the Vectorworks Dev Wiki gives minimal assistance on usage. I got it to work without explicitly stating the LBControlType. I was missing the SetLBItemDisplayType call. Also my sequencing was a bit off. You need to call SetLBItemDisplayType before any other Enablings for the Listbrowser. Live and learn, live and learn.. edit Also you need to call "SetLBHierDispColumn" before "EnableLBHierDisplay" for some reason. 🤷‍♀️ Thanks again
  2. As Pat suggested GetSymLoc is the one you're wanting to use for plugin objects. I have no experience with Spotlight, so can't add to what Pat has mentioned apart from converting that into python: h2 = vs.FSActLayer() # Plugin Object h1 = vs.NextObj(vs.FIn3D(h2)) # Symbol With Plugin Object if h1 is None: vs.AlrtDialog('Nil') else: x2, y2 = vs.GetSymLoc(h2) x1, y1 = vs.HCenter(h1) vs.AlrtDialog("Insert Point is : {:.2f}, {:.2f}".format(x2, y2)) vs.AlrtDialog("Symbol Dims : {:.2f}, {:.2f}".format(x2 - x1, y2 - y1)) vs.AlrtDialog("Center of HP is : {:.2f}, {:.2f}".format(x2 + x1, y2 + y1))
  3. Greetings all, Anyone got the vs.SetLBHierDispColumn function to work? I can't seem to get it to display the listbrowser in a hierarchy. Just checking to see if possible/or if i'm doing something wrong before I file a bug report. Cheers Tui
  4. twk

    Data Tags

    h = Data Tag Object Handle import vs; def GetTaggedObject(h): result = False; num = vs.GetNumAssociations(h); assH = None assKind = None value = None i = 0; while(i < num and result == False): assH, assKind, value = vs.GetAssociation(h, i); if (assKind == 37): result = True; i = i + 1; return result, assH;
  5. My python work-in-progress template: def __temp_funcs(self): kObjXPropEditGroup = vs.SetObjPropVS(1, True) # -- Object has non-default "Enter Group" behavior. PIO objects can enter the profile or path group kObjXPropHasLayerScaleDeps = vs.SetObjPropVS(2, True) # -- Object wants to be reset with when its layer scale changes. kObjXPropPreference = vs.SetObjPropVS(4, True) # -- Object Definition Procedure (ODP) handles ParametricPreferencesMessage::kAction event. kObjXPropDirectModeling = vs.SetObjPropVS(5, True) # -- Object Definition Procedure (ODP) handles handles Direct Modeling events. kObjXPropAttributeTool = vs.SetObjPropVS(6, True) # -- Object Definition Procedure (ODP) handles handles Attribute Mapping events. kObjXPropCustomCursorResize = vs.SetObjPropVS(9, True) # -- // // boolean value // // The O kObjXPropDefaultPropertyUI = vs.SetObjPropVS(11, True) # -- // // unsigned char // // The bits in this property describe the UI displayed kObjXPropCustomHideFactor = vs.SetObjPropVS(16, True) # -- The parametric object provides custom scale threshold to be used to hide inner objects kObjXHasCustomWidgetValues = vs.SetObjPropVS(17, True) # -- OnObjectWidgetValueCall::kAction kObjXPropAcceptStates = vs.SetObjPropVS(18, True) # -- The parametric accpets ObjectState::kAction event kObjXPropPreserveContents = vs.SetObjPropVS(20, True) # -- VectorWorks will not delete the contents of the parametric kObjXPropHasContextMenu = vs.SetObjPropVS(21, True) # -- Sends ObjectContextMenuEvent::kAction_Init and ObjectContextMenuEvent::kAction_Event kObjXPropResetBeforeExport = vs.SetObjPropVS(23, True) # -- This plugin will be reset before Print or Export kObjXPropRedSymbolIsStyle = vs.SetObjPropVS(25, True) # -- Red Symbol of this object can be used to drag&drop kObjXPropHasAttrMappingGeom = vs.SetObjPropVS(26, True) # -- Sends ObjectGetSpecificGeometryCall::kAction with message is (OnObjectGetSpecificGeometry*) kObjXPropHasSectionVPGeom = vs.SetObjPropVS(27, True) # -- Sends ObjectGetSpecificGeometryCall::kAction with message is (OnObjectGetSpecificGeometry*) kObjXPropHasLayerElevDeps = vs.SetObjPropVS(28, True) # -- Resets the parametric if the layer elevation changes kObjXPropHasLayerHeightDeps = vs.SetObjPropVS(29, True) # -- Resets the parametric if the layer height changes kObjXPropLeaderLinePtIndex = vs.SetObjPropVS(33, True) # -- Controls whether how and a paremetric will be recognized by the align leader line menu command kObjXPropLabelPtIndex = vs.SetObjPropVS(34, True) # -- Controls whether how and a paremetric will be recognized by the align leader line menu command kObjXPropDataNameDisabled = vs.SetObjPropVS(35, True) # -- Controls whether the name field on the data pane should be disabled kObjXPropDirectionArrow = vs.SetObjPropVS(39, True) # -- Controls whether the direction arrow should be displaied kObjXPropIsSymbolBased = vs.SetObjPropVS(40, True) # -- Controls whether the object is symbol based and to show context menu "Locate Symbol In Resource Browser" kObjXPropTextStyleSupport = vs.SetObjPropVS(42, True) # -- Controls whether parametric objects can use class text style attribute and get Text Style on OIP kObjXPropDontShowZLocation = vs.SetObjPropVS(45, True) # -- When set to true will remove the Z coordinate for the location widget in the OIP for the parametric kObjXPropGetDragEvents = vs.SetObjPropVS(47, True) # -- Controls whether a parametric will recieve Drag events allowing it to draw custom geometry kObjXPropOIPNameHidden = vs.SetObjPropVS(48, True) # -- Controls whether the name field on the OIP should be hidden kObjXSupportsStyles = vs.SetObjPropVS(49, True) # -- Controls whether a parametric type support plug-in styles kObjXPropUseLayerCutPlane = vs.SetObjPropVS(51, True) # -- Controls whether a parametric object supports Layer Cut Plane values. kObjXPropAllowFreeHybrid2DPath = vs.SetObjPropVS(52, True) # -- Controls whether a Hybrid 2D Path parametric can have a path on a different plane than the object kObjXCatalogSupport = vs.SetObjPropVS(63, True) # -- Controls whether a parametric type supports catalogs kObjXPropDontShowTextureWidgets = vs.SetObjPropVS(64, True) # -- When set to true will remove the texture widgets in the Render pane of OIP for the parametric object kObjXPropHidePlanarDropDown = vs.SetObjPropVS(71, True) # -- When set to true will hide planar dropdown for the widget in the OIP for the parametric
  6. I have a set one up similar to one Josh had posted somehwere before. Could I have a peak at yours Josh, to compare? Por Favor 😀
  7. twk

    Type 32?

    The parent of an object in the annotation space is the Annotation Group (Type 11=Group), Viewports have multiple components of itself > Eg. https://developer.vectorworks.net/index.php/VS:GetVPGroup To get the Viewport you use GetVPGroupParent (https://developer.vectorworks.net/index.php/VS:GetVPGroupParent). -edit- as to what a Header type is, I don't know. Full type list of objects is in the C++ SDK.
  8. We layer reference in the design layer, then viewport that onto the master/overall layer. Cumbersome I know, but that workflow, works for us.
  9. We use DLVP's as well. The brain wrecking part is when you have to do window and door schedules in this scenario. e.g You have an overall plan (Design Layer) that contains different floor plan types (in this case, in the form of Design Layer Viewports). When it comes to scheduling doors/windows, if these are in the DLVP's, then your schedule would have to calculate what viewport types are on that overall plan, and then calculate what window types belong to that particular plan type. A simple terrace housing complex is ok. Up scale that to a six story complex with 8 plan types mixed in at each level, and your in a living nightmare. We've alleviated that particular scenario through custom scripting, but if the new Unit Plan methodology would be able to cater for this that would be great.
  10. I wonder if Unit Plans means having say, apartment 'types' in an Apartment complex project. Maybe a mix between symbol functionality and viewport functionalities? Think 'Plugin Styles' but for floor plans? Who knows, the terminology is very vague. The renovation phasing feature in Archicad seems promising though.
  11. 1. 3D Structural Grid.. YES! 2. Materials - sounds good in demo vid and concept, but will wait for release to believe it! Ha! 3. Type Legends - couldn't come soon enough.. but she did use a keyword "in the future", so maybe not next release..
  12. Yes, above script is a snippet of the working script, all is working well now. My problem was incorrectly setting default values. I have now managed to complete our revision cloud tool to pull and push data to the new titleblocks. Cheers
  13. Apologies, my record handle for setting default values was wrong. vs.SetRField(self.plugin_object.record_def_handle, self.plugin_object.plugin_name, self.parameter_name, value) self.plugin_object.record_def_handle should be calling vs.GetObject(vs.GetName(vs.GetParametricRecord(self.handle))), not vs.GetParametricRecord(self.handle). Full script below: import vs alert_dialog = lambda x:vs.AlrtDialog(str(x)) class PluginObject(): class PluginParameter(): def __init__(self, plugin_object, parameter_name:str): self.plugin_object = plugin_object #type: PluginObject self.parameter_name = parameter_name def __str__(self): return "{}".format(self.parameter_name) @property def value(self): return vs.GetRField(self.plugin_object.handle, self.plugin_object.plugin_name, self.parameter_name) @value.setter def value(self, value): vs.SetRField(self.plugin_object.handle, self.plugin_object.plugin_name, self.parameter_name, value) vs.ResetObject(self.plugin_object.handle) @property def value_default(self): return vs.GetRField(self.plugin_object.record_def_handle, self.plugin_object.plugin_name, self.parameter_name) @value_default.setter def value_default(self, value): vs.SetRField(self.plugin_object.record_def_handle, self.plugin_object.plugin_name, self.parameter_name, value) vs.ResetObject(self.plugin_object.handle) def __init__(self, handle): self.handle = handle self.record_handle = vs.GetParametricRecord(self.handle) self.record_def_handle = vs.GetObject(vs.GetName(self.record_handle)) self.plugin_name = vs.GetName(self.record_handle) @property def list_parameters(self): data = [] for x in range(vs.NumFields(self.record_handle)): fldname = vs.GetFldName(self.record_handle, x+1) data.append(PluginObject.PluginParameter(self,fldname)) return data def get_parameter_by_name(self, parameter_name:str): for x in self.list_parameters: if x.parameter_name == parameter_name: return x tb = PluginObject(vs.FSActLayer()) revision_mark = tb.get_parameter_by_name('Revision Mark') revision_mark.value_default = 'Numbers' alert_dialog(revision_mark.value_default)
  14. We too have setup automatic revision control internally and externally of vectorworks. However with the new 2019 Titleblock, I can't seem to set Revision Increment value to Manual or Auto through script (vs.SetRField). Tried: - Set Plugin Default field value - Setting value/default value throughout all Titleblocks in document - Setting value/default value throughout all Plugin Style Titleblocks in document What is the logic here? @Nikolay Zhelyazkov
  15. import pandas as pd import vs import os layer = "AC_Parcel_polygon" # pass in whatever layer name your polygons are on criteria = "(((T=POLY)|(T=POLYLINE)) & (L='{}'))".format(layer) # criteria string that finds polygons, polylines on layer=layer polygons = [] # list to store polygons def collect_polygons(h): polygons.append(h) vs.ForEachObject(collect_polygons, criteria) # use ForEachObject to collect polygons # code to store polygon data in pandas datatframe, # Format= # row_index, Polygon Index, Polygon Vertex Index, Polygon Vertex Type, Polygon Vertex Radius databased_polygons = [] for i, poly in enumerate(polygons): vertices = vs.GetVertNum(poly) for v_index in range(vertices): vrtxPt, vrtxType, vrtxRadius = vs.GetPolylineVertex(poly, v_index+1) databased_polygons.append([i, v_index, vrtxPt, vrtxType, vrtxRadius]) columns = ["Polygon Index", "Vertex Index", "Vertex Type", "Vertex Type", "VertexRadius"] dataframe = pd.DataFrame(databased_polygons, columns=columns) script_path = '' # enter dir path here to store csv file dataframe.to_csv(os.path.join(script_path, "Polygons.csv")) # store dataframe in csv for external checking print(dataframe) raise Exception # raise exception to see print data in error console in vectorworks
  16. If I am understanding your question correctly, you're wanting to grab the polygon vertex information, and transfer them to a pandas dataframe? If so: 1. You run a criteria to collect all the polygons that you're wanting 2. Then use vs.GetPolylineVertex(obj, vertexNum) to grab the coordinates of each vertex, collect those vertices coordinates and place in dataframe. I will have a go at it later this evening..
  17. Ahh thats a shame, I shall explore some external python libraries.. WxPython, TKinter etc. This still happens sadly..
  18. Does anyone know how to have a infinite cylce of progress until a function is finished? Is this possible with Python/Vectorscript calls? A note on the SDK example page says it is possible, http://developer.vectorworks.net/index.php/SDK:Progress_Dialoghttp://developer.vectorworks.net/index.php/SDK:Progress_Dialog. Wondering if thats unique to the C++ SDK..
  19. The aim is to have the worksheet as a sort of staging area for the filtering and sorting of windows/doors. -- (I'm creating an automatic window/door elevation tool for schematic scheduling) Once the filtering was set I found there was no way for me to sift through the displayed subrow data and grab the object handles to create the elevation on the drawing. Now I can! I did use the ForEachObject() on the db criteria, however any sorting that happened on the worksheet was difficult to replicate through my script. I'd rather have the sorting/grouping all done on the worksheet, and then have the graphical display just pull from the UUID on the worksheet.
  20. This will actually do it. Thanks a million guys. How do you find these @JBenghiat! On that note, would you know if there is a function call for this for worksheets? I've resorted to creating a script to pull that info into the worksheet, and can then cylce through the worksheet to grab the UUID and the object on the drawing. Would be perfect if I could skip the script part, as everytime the worksheet resets it asks me to execute the script. In any case, thanks again.
  21. Interesting. How do you convert a handle representation back into a handle?
  22. Greetings all, I have a worksheet that shows all windows/doors in the drawing. I was trying to grab handles to these objects from the worksheet database, but could not find any sdk functions to call it. So I added an extra column that calls the GlobalID from the IFCDoor/IFCWindow, and noticed that these are as expected all unique ids. My question is, does this ID, remain throughout the life of the drawing document? as opposed to handles? Could I then use these ID's to uniquely identify these in a script database somehow? Cheers, Tui
  23. I was wanting to call a function from another script that is within the document resources. Not on a file somewhere else on the computer. cheers
  • Create New...