ge25yak
Member-
Posts
14 -
Joined
-
Last visited
Reputation
0 NeutralPersonal Information
-
Location
Germany
-
Another very weird thing about vs.IFC_ExportWithUI() is that it can't export space objects: # create a new layer with story layer_h = vs.CreateLayer("layer2", 1) vs.SetLayerLevelType(layer_h, 'Slab') ok = vs.CreateStory("Story-2", "0") story_h = vs.GetObject("Story-2") vs.SetLayerElevation(layer_h, 2700, 0) ok = vs.AssociateLayerWithStory(layer_h, story_h) vs.SetStoryElevation(story_h, 2700) vs.ClosePoly() vertices = [(0,0), (0,10000), (10000, 10000), (10000, 0)] vs.Poly(*vertices) poly_h = vs.LNewObj() space_h = vs.Space_CreateSpace(poly_h, 0) # export IFC, no ifcspace found in export vs.IFC_ExportWithUI(True) I think this is a bug!
-
I opened a new project in Vectorworks, created a new layer and story in it using the API, and finally found that I could not export the IFC using vs.IFC_ExportNoUI. # create a new layer with story layer_h = vs.CreateLayer("layer2", 1) vs.SetLayerLevelType(layer_h, 'Slab') ok = vs.CreateStory("Story-2", "0") story_h = vs.GetObject("Story-2") vs.SetLayerElevation(layer_h, 2700, 0) ok = vs.AssociateLayerWithStory(layer_h, story_h) vs.SetStoryElevation(story_h, 2700) # export IFC, doesn't work vs.IFC_ExportNoUI("test_path.ifc") I realized that I had to "save the settings" in the IFC export window in the project before I used this function. But the problem is that after saving the settings, if I continue to add new layers/stories to the project, the layer mapping does not occur automatically when exporting the IFC - I have to manually map the layers and update the number of stories. Is there a way to automatically update the layer/story mapping and export IFC without UI?
-
Hi, is it possible to use api to duplicate/delete layers? I've tried with vs.CreateDuplicateObject, vs.HDuplicate, vs.DelObject by passing the layer handle, but they didn't work.
-
No IfcSpace in exported IFC after vs.Space_AddName
ge25yak replied to ge25yak's topic in Python Scripting
My current workaround is to use vs.IFC_SetProperty to set the name and id in ifc data, since my goal is to see this information in exported ifc... Another thing I noticed is that when I re-checked "show 2d boundary" in oip, the space reappeared. I tested in 2024. -
Hi, I'm trying to create spaces from polygons using API and automatically assign some names to them. vertices = [(0, 0), (18000, 0), (18000, 12000), (0, 12000)] vs.Poly(*vertices) hpoly = vs.LNewObj() space_h = vs.Space_CreateSpace(hpoly, 0) If I stop here, everything looks good. An unstyled space was created and I can export it in ifc. But when I continue editing the space, I find that the 2D boundary of the space has disappeared. This makes the exported ifc file has no IfcSpace! vs.Space_AddRoomID(space_h, "test") vs.Space_AddName(space_h, "test123") area = vs.Space_GetNetArea(space_h) vs.AlrtDialog(f"space area: {area}") # the area is always 0
-
@Jesse Cogswell Thanks! I wrote a Python version to output handles of the nested PIOs within a given wall: from functools import partial def get_nested_pios_in_wall(wall_h): def find_related_pios(pio_h, wall_h): pio_list = [] h_wall_found = vs.GetParent(pio_h) if h_wall_found == wall_h: pio_list.append(pio_h) vs.AlrtDialog(str(pio_list)) partial_find_set_related_pios = partial(find_set_related_pios, wall_h=wall_h) vs.ForEachObject(partial_find_set_related_pios, "T=PLUGINOBJECT")
-
Hi all, I have two questions regarding the windows/doors in the walls: Given a handle of a wall, how can I find the handles of PIO(doors, windows) that are added to this wall? I use vs.CreateDuplicateObject(h_wall, vs.Handle(0)) to duplicate the wall. I noticed that if there are doors or windows in the wall, they are automatically copied along with the wall. How can I duplicate only the wall itself?
-
Hi, I' using the following code to create a pitched roof in Vectorworks, but always got a pop-up error "Could not create roof, probably not enough walls". Does anyone know why? # Define the coordinates for the roof base roof_vertices = [(0, 3000), (5000, 3000), (5000, 0), (0, 0)] # Create a polygon for the roof base vs.Poly(*roof_vertices) poly_h = vs.LNewObj() # Create a pitched roof using the polygon as the base hroof = vs.CreateRoof(False,0,0,0,0) num = vs.GetVertNum(poly_h) for i in range(num): i = i+1 vertex = vs.GetPolylineVertex(poly_h,i)[0] slope=30 eave_overhang=500 eave_height=3000 vs.AppendRoofEdge(hroof, vertex, slope, eave_overhang, eave_height) bearingInsetDistance = 10 roof_thickness=300 vs.SetRoofAttributes(hroof, False, bearingInsetDistance, roof_thickness, 1, 0) # error after excuting this line vs.SetClass(hroof, "Roofs")
-
Hi all, I took the advice to use uuid to track elements. In most cases it works fine, but I observed something strange when using vs.CreateSlab(). Here is my code: vertices = [(1130,1570),(550,1570),(550,1280),(990,1280),(990,1130),(840,1130),(840,550),(1130,550)] vs.ClosePoly() vs.Poly(*vertices) # create polygone from vertices poly_h = vs.LNewObj() poly_uuid = vs.GetObjectUuid(poly_h) for i in range(5): poly_h = vs.GetObjectByUuid(poly_uuid) vs.AlrtDialog(f"handle iter:{i} " + str(poly_h)) # poly_h is always 0 after 1st iteration, with the same uuid it cant find the corresponding handle hslab = vs.CreateSlab(poly_h) poly_uuid = vs.GetObjectUuid(poly_h) vs.AlrtDialog(f"uuid iter:{i} " + str(poly_uuid)) # the poly_uuid matches the initial one in the first iteration It looks like after passing the polygon's handle to the CreateSlab function, the handle re-found using its corresponding uuid will always be 0 (None). Not sure if this is a bug. Any ideas about how to track the polygon using uuid after the create slab operation?
-
Hi, I was trying to set the height attribute of an unstyled wall at first floor to for instance 5m using vs.HWallHeight(h, 0, 5) or vs.SetWallHeights(h, 0, 5), but none of them worked. I just got none as returned values from both of them. Does anyone know how to adjust wall height properly via python api?
-
Thanks a lot guys! Another question about the handle: is there a way to convert string to handle? I somehow need to temporarily store the handles in json and reload them. However I found that if I pass the handle as string to function like handle='A77637D8' vs.DelObject(handle) it won't work.
-
Hi all, thanks for the excellent explanation! Instead of get single object(handle) through vs.FSActLayer() or vs.LNewObj(), are there any ways to batch get objects(handles) using api? For instance, like get all wall objects or door/window objets from model, so I'm able to batch processing the elements.
-
Live connection between web app and marionette
ge25yak replied to Timothy Besada's topic in Python Scripting
I'm also searching for a python solution for such use case. Please let me know if you have any ideas. Thanks! -
Hi, any updates about this?