Jump to content

twk

Member
  • Content Count

    579
  • Joined

  • Last visited

Community Reputation

208 Spectacular

5 Followers

About twk

  • Rank
    500 Club

Personal Information

  • Occupation
    Architectural Designer
  • Homepage
    www.cba-design.co.nz
  • Location
    New Zealand

Recent Profile Visitors

2,492 profile views
  1. 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
  2. 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)
  3. 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
  4. 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
  5. 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..
  6. twk

    Progress Dialog

    Ahh thats a shame, I shall explore some external python libraries.. WxPython, TKinter etc. This still happens sadly..
  7. 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..
  8. 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.
  9. 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.
  10. Interesting. How do you convert a handle representation back into a handle?
  11. 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
  12. 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
  13. We class our Site Model (Site-DTM-Main), then toggle that to grey when we need to manipulate other objects on the same layer as the site model. You are true that it is a pain that the Site Model takes precedence over any other object.
  14. FYI: Unreal has bought out Quixel now. Making megascans available to all UE users for free! Also, free Twinmotion extened to the 1st quarter of 2020. https://www.unrealengine.com/en-US/blog/unreal-engine-4-24-to-ship-with-free-quixel-megascans-unreal-studio-features-and-more Not sure what the gameplan is for UnrealEngine, but they seem to be making alot of assets free. Would be beneficial for the Devs @ Vectoworks look into a direct import/export process.
  15. twk

    Using try/except

    You'd have to use document list handling. Symbols are resources, so you'd build a resource list and cycle through the names in that list to see whether that symbol exists. http://developer.vectorworks.net/index.php/VS:BuildResourceList2

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...