Jump to content

Silas

Member
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

1 Neutral

1 Follower

About Silas

  • Rank
    Greenhorn

Personal Information

  • Location
    Switzerland

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Silas

    Counter for DoorID

    Hello, I try to get an automatic door ID generator. The main part is done - but in the middle of the door ID should be a counter. If there is a room with more than one door, we need different door IDs. That's why we should have a counter in the middle. I tryed something (after #Number Check for Count) but just get the total count in each door and not 1,2,3 ... Thank you Silas import vs c_door = "(PON='Door CW')" door_list = [] door_id_pos = 4 def Add_Handle(obj): door_list.append(obj) vs.ForEachObject(Add_Handle,c_door) full = [] full_list = [] for element in door_list: bool, space_nr = vs.IFC_GetSpaceParamFO(element, '3') full.append(element) space_nr1 = vs.SubString(space_nr,',',1) space_nr2 = vs.SubString(space_nr,',',2) full.append(space_nr1) if space_nr2 != '': full.append(space_nr2) full_list.append(full) full = [] for item in full_list: first_spacenr = item[1] try: second_spacenr = item[2] except IndexError: second_spacenr = '' vs.AlrtDialog('Eine Türe ohne zwei Räume gefunden') vs.SetSelect(item[0]) #Number Check for Count y = 0 i = 0 imax = len(full_list) number = 0 while i < imax: if item[1] in full_list[y]: number = number + 1 y = y + 1 i = i + 1 #Set Door ID number_space = first_spacenr +'_'+ str(number) + '_' + second_spacenr vs.SetRField(item[0],'Door CW','DoorID',number_space) vs.ResetObject(item[0]) number = 0
  2. Silas

    Highest Record Number

    Hello I think the best way is to create a database and link the database to a symbol. To Update the Database use a simple script something like this: (this one is for spaces) import vs c = ("(PON='Space')") number = vs.Count(c) vs.AlrtDialog(number) vs.SetRecord(DATABASE,number) In the second line you can change your search criteria. In the last line the script write the number in your database. greetings Silas
  3. Silas

    Number stamp tool with python - how?

    Hello Benedick I tryed a few possible solutions but get no results. The main problem is that "in Python this function will NOT block execution. It will execute a callback function with the resulted point" http://developer.vectorworks.net/index.php/VS:GetPt So I tryed to get around with a second while loop like: mdwn = False mdwn, na = vs.MouseDown() n = n + i if mdwn == True: continue But it iterates over and over. So maybe in a future version vs.GetPt() or vs.MouseDown() is like a dialog userinput. Silas
  4. Hey, My Problem: (Static Solved Code attached) At the moment we rotate the hatch after each DWG Import. Normally not a big deal but because in this project we get so much input it's nearly impossible - or a full time job. So the goal is to get this rotation with a script. before i continue to create for each object a individual hatch, is there a function to just rotate the hatch in a object? something like vs.RotateHatch(h, rotation) ? My attempt at the moment: (beside recording the position and coordinates from each object - and get the rotation) SOLVED Updated Version for Static Hatch: ------------------------------------------------------ cp = ("(T=POLY)") cl = ("(T=POLYLINE)") input_hatch = vs.StrDialog('Schraffur Name eingeben','') input_hatch_angle = int(vs.StrDialog('Winkel der Schraffur als Zahl angeben: Bsp: 45, 30 etc','')) def GetRotation(h): global m m = float() global rotation rotation = float() global angle angle = float() for vertexNum in range(0, vs.GetVertNum(h)): point, v_type_nil, angle_nil = vs.GetPolylineVertex(h, vertexNum) point1, v_type_nil, angle_nil = vs.GetPolylineVertex(h,1) point2, v_type_nil, angle_nil = vs.GetPolylineVertex(h,2) point3, v_type_nil, angle_nil = vs.GetPolylineVertex(h,3) point4, v_type_nil, angle_nil = vs.GetPolylineVertex(h,4) point5, v_type_nil, angle_nil = vs.GetPolylineVertex(h,5) point6, v_type_nil, angle_nil = vs.GetPolylineVertex(h,6) #Richtungsvektoren: #AB = B - A = [1, -1] - [-3, 2] = [4, -3] ax = float(0.0) ay = float(0.0) bx = float(0.0) by = float(0.0) cx = float(0.0) cy = float(0.0) dx = float(0.0) dy = float(0.0) ex = float(0.0) ey = float(0.0) fx = float(0.0) fy = float(0.0) ab = float(0.0) bc = float(0.0) cd = float(0.0) de = float(0.0) ef = float(0.0) de_x = float(0.0) de_y = float(0.0) ef_x = float(0.0) ef_y = float(0.0) countvert = int(vs.GetVertNum(h)) if countvert <= 4: ax = point1[0] ay = point1[1] bx = point2[0] by = point2[1] cx = point3[0] cy = point3[1] dx = point4[0] dy = point4[1] elif countvert <= 5: ax = point1[0] ay = point1[1] bx = point2[0] by = point2[1] cx = point3[0] cy = point3[1] dx = point4[0] dy = point4[1] ex = point5[0] ey = point5[1] else: ax = point1[0] ay = point1[1] bx = point2[0] by = point2[1] cx = point3[0] cy = point3[1] dx = point4[0] dy = point4[1] ex = point5[0] ey = point5[1] fx = point6[0] fy = point6[1] if countvert <= 4: ab_x = bx - ax ab_y = by - ay bc_x = cx - bx bc_y = cy - by cd_x = dx - cx cd_y = dy - cy elif countvert == 5: ab_x = bx - ax ab_y = by - ay bc_x = cx - bx bc_y = cy - by cd_x = dx - cx cd_y = dy - cy else: ab_x = bx - ax ab_y = by - ay bc_x = cx - bx bc_y = cy - by cd_x = dx - cx cd_y = dy - cy de_x = ex - dx de_y = ey - dy ef_x = fx - ex ef_y = fy - ey # vs.CreateText(str(de_x)) # vs.CreateText(str(de_y)) ab = vs.Sqrt(ab_x * ab_x + ab_y * ab_y) bc = vs.Sqrt(bc_x * bc_x + bc_y * bc_y) cd = vs.Sqrt(cd_x * cd_x + cd_y * cd_y) de = vs.Sqrt(de_x * de_x + de_y * de_y) ef = vs.Sqrt(ef_x * ef_x + ef_y * ef_y) # listdist = [ab,bc,cd,de,ef] # vs.CreateText(str(listdist)) # vs.AlrtDialog(str(dx)) # vs.AlrtDialog(str(dy)) if ab > bc and ab > cd and ab > de and ab > ef: gk = by - ay ak = bx - ax #vs.AlrtDialog(str(gk)) #vs.AlrtDialog(str(ak)) if ak != 0: angle = vs.Rad2Deg(vs.ArcTan(gk/ak)) m = gk / ak elif bc > cd and bc > de and bc > ef: gk = cy - by ak = cx - bx if ak != 0: angle = vs.Rad2Deg(vs.ArcTan(gk/ak)) m = gk / ak elif cd > de and cd > ef: gk = dy - cy ak = dx - cx if ak != 0: angle = vs.Rad2Deg(vs.ArcTan(gk/ak)) m = gk / ak elif de > ef: gk = ey - dy ak = ex - dx if ak != 0: angle = vs.Rad2Deg(vs.ArcTan(gk/ak)) m = gk / ak else: gk = fy - ey ak = fx - ex if ak != 0: angle = vs.Rad2Deg(vs.ArcTan(gk/ak)) m = gk / ak #vs.AlrtDialog(str(angle)) if gk == 0: angle = 0 if ak == 0: angle = 90 if angle < 0: angle = - angle #IF Function #0 if input_hatch_angle == 0: if angle == 0: rotation = 90 if angle == 90: rotation = 0 else: if m > 0: rotation = - 90 + angle if m < 0: rotation = 90 - angle #90 if input_hatch_angle == 90: if angle == 0: rotation = 0 if angle == 90: rotation = 90 else: if m > 0: rotation = angle if m < 0: rotation = - angle #45 if input_hatch_angle == 45: if angle == 90: rotation = 0 if angle == 0: rotation = 0 else: if m > 0: rotation = - angle if m < 0: rotation = 90 - angle #Hatch Control / Rotation hatch_h = vs.GetVectorFill(h) #vs.AlrtDialog(str(hatch_h)) # Attribute Control and Record if hatch_h[0] == True: if input_hatch == hatch_h[1]: vs.CreateStaticHatchFromObject(h,input_hatch,0,0,rotation) # vs.AlrtDialog(hatch_h) vs.ForEachObject(GetRotation,cp) vs.ForEachObject(GetRotation,cl) #h = vs.LNewObj() #vs.SelectObj(h) #vs.SelectObj(cl) #vs.SelectObj(cp) ------------------------------------------- thank you Silas
  5. Silas

    Criteria Search with Variable

    It works finally thanks a lot! best regards
  6. Hello, First sorry for my bad english I'm from Switzerland :) I tryed to creat a multible SelectObj Script for our Spacetool. Now I have no ideas left why my script doesnt work - i get always the error output, for my variable when i have more than one word in my input dialog. The strange thing is, when i write my input direct in the string it works fine. Simple Script that work: criteria = ("('Space'.'Floor Finish'='Platten weiss')") vs.SelectObj(criteria) My idea for the script: eingabe = vs.StrDialog('Material eingeben','') vs.AlrtDialog('Folgendes wird nun ausgewählt '+ eingabe) criteria = ("('Space'.'Floor Finish'="+eingabe+")") vs.SelectObj(criteria) In my PY Charm the script works allready... (is that a vectorworks based bug or problem?) Thank you

 

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.

×