Jump to content

MullinRJ

Member
  • Posts

    1,985
  • Joined

  • Last visited

Reputation

510 Spectacular

Personal Information

  • Occupation
    Circuit Board Designer
  • Location
    United States

Recent Profile Visitors

5,821 profile views
  1. Hello @ge25yak, There may be other ways to set the wall height, but I found this works, so I stopped looking for other ways. The commands below always use mm, so you have to convert your document units to mm before setting the wall height values, hence the use of the scale factor variable "SF". This overly simple script will change the selected wall height to 5 (document units). I assumed meters in this case. Using your document units change the "newWallHt" value to your liking. import vs # Sample script to set the height (top elevation) of a selected wall. newWallHt = 5 # document units WallStartHeightTop = 604 WallEndHeightTop = 606 WallStartHeightBot = 605 WallEndHeightBot = 607 SF = vs.GetPrefReal(152) / 25.4 # units per mm H = vs.FSActLayer() vs.SetObjectVariableReal(H, WallStartHeightTop, newWallHt/SF) # starting height in mm vs.SetObjectVariableReal(H, WallEndHeightTop, newWallHt/SF) # ending height in mm vs.ResetObject(H) vs.SysBeep() HTH, Raymond
  2. Hi @Andreas, Yes, that is the call to insert a symbol/pio into a wall. Using VW to help reverse engineer the code, I placed a Window in Wall and exported the VW file to a script file that defines the geometry. Use menu File>Export>Export Script... This doesn't always work for complicated files, but for simple things it's a great way to see what calls are used and how they are arranged. Here's a small script I built by copying the Wall and Window from the text dump (Export Script...). I found the relevant calls in the middle of the file and copied them to a new file, then rearranged a few calls and renamed the temp handles to make it easier to follow. Comments were also added for readability. To see what this represents, copy and paste this code into a script resource and run it. Then change some number, rerun, and notice the effects of the changes. It's a great learning tool for new commands. PROCEDURE xxx; { Sample script to insert a Window into a Wall. The units are in mm. } VAR WallHandle, WindowHandle :Handle; boolResult :Boolean; BEGIN { set pen and fill attributes } PenSize(1); PenPatN(2); FillPat(1); PenFore(0, 0, 0); PenBack(65535, 65535, 65535); FillFore(0, 0, 0); FillBack(65535, 65535, 65535); NameClass('None'); { set class to use } Wall(-5400, 2000, 5000, 2000); { create a wall } SetObjectVariableReal(LNewObj, 604, 3048); { Wall Start Height Top } SetObjectVariableReal(LNewObj, 605, 0); { Wall Start Height Bottom } SetObjectVariableReal(LNewObj, 606, 3048); { Wall End Height Top } SetObjectVariableReal(LNewObj, 607, 0); { Wall End Height Bottom } SetObjectVariableReal(LNewObj, 621, 3048); { Wall Overall Height Top } SetObjectVariableReal(LNewObj, 622, 0); { Wall Overall Height Bottom } SetObjectVariableReal(LNewObj, 618, 152.4); { Set Wall Width } DoubLines(152.4); ClearCavities; { start with an empty wall } WallHandle := LNewObj; { save handle to the Wall } WallCap(FALSE, TRUE, FALSE, 0, 0); AddSymToWallEdge(LNewObj, 5300, 0, FALSE, FALSE, 'Window', 0); { insert object into wall } boolResult := SetObjWallInsLocOff(LNewObj, WallHandle, 0); { shifts object to inside/outside of wall } WallCap(TRUE, TRUE, FALSE, 0, 0); ResetObject(WallHandle); { reset the Wall object } WindowHandle := LNewObj; { save handle to the Window - not used, but could be used later } SysBeep; { make noise when done } END; Run(xxx); Here's the same thing in Python. Again, the code was gathered from text dump from the program using Export Script. import vs # Sample Python script to insert a Window into a Wall. The units are in mm. # set pen and fill attributes vs.PenSize(1) vs.PenPatN(2) vs.FillPat(1) vs.PenFore((0, 0, 0)) vs.PenBack((65535, 65535, 65535)) vs.FillFore((0, 0, 0)) vs.FillBack((65535, 65535, 65535)) vs.NameClass('None') # set class to use vs.Wall(-5400, 2000, 5000, 2000) # create a wall vs.SetObjectVariableReal(vs.LNewObj(), 604, 3048) # WallStartHeightTop vs.SetObjectVariableReal(vs.LNewObj(), 605, 0) # WallStartHeightBottom vs.SetObjectVariableReal(vs.LNewObj(), 606, 3048) # WallEndHeightTop vs.SetObjectVariableReal(vs.LNewObj(), 607, 0) # WallEndHeightBottom vs.SetObjectVariableReal(vs.LNewObj(), 621, 3048) # WallOverallHeightTop vs.SetObjectVariableReal(vs.LNewObj(), 622, 0) # WallOverallHeightBottom vs.SetObjectVariableReal(vs.LNewObj(), 618, 152.4) # SetWallWidth vs.DoubLines(152.4) vs.ClearCavities() # start with an empty Wall WallHandle = vs.LNewObj() # save handle to the Wall vs.WallCap(False, True, False, 0, 0) vs.AddSymToWallEdge(vs.LNewObj(), 5300, 0, False, False, 'Window', 0) # insert object into wall boolResult = vs.SetObjWallInsLocOff(vs.LNewObj(), WallHandle, 0) # shifts object to inside/outside of wall vs.WallCap(True, True, False, 0, 0) vs.ResetObject(WallHandle) # reset the Wall object WindowHandle = vs.LNewObj() # save handle to the Window - not used, but could be used later vs.SysBeep() # make noise when done One caveat to keep in mind, LNewObj is a function that returns a handle to the last object created (usually — but Groups don't follow this rule when they get created.) Think of LNewObj as a temporary handle. If you want to save a handle for use later in the script, assign LNewObj to a program variable and keep on drawing. Notice "WallHandle" is used this way. HTH, Raymond
  3. Hi @mgvwx, I have not used the GIS calls in any of my scripts yet, and I don't know how much you know about scripting, but these are the commands in the GIS section of the Script Reference. BindLayerToArcGISFS GISDimStringToMM BindLayerToWFSFS IsGeoreferenced EditGeorefWithUI LegacyShapefileExp GeogCoordToVW LegacyShapefileImp GeogCoordToVWN RemoveGeoref GetAngleToNorth SetDocGeoRefByUsrOrg GetGISOrigin SetGISLayer GetGISOriginN SetProjectElevation GetProjectElevation UpdateFeatureLayer GetProjectionLocName UpdateLayerFromFS GetProjectionProj4 VWCoordToGeog GetProjectionWKT VWCoordToGeogN You can view them in the Developer WIKI online https://developer.vectorworks.net/index.php/VS:Function_Reference, or in the HTML Script Reference located in you application folder .../Vectorworks 2024/VWHelp/Script Reference/ScriptFunctionReference.html Do you have a sample file you can post? Smaller is better. It might help people try out some of these calls against actual data and give you some feedback. Raymond
  4. Hi @EBV_Nick, Could you post an example file of your objects? It doesn't need to the whole file, maybe a few dozen symbols. The easiest way to create a sample file is to select a handful of objects, copy them, and paste them in place (Alt-V) in a new file. It will be easier to make suggestions if we can see actual data. Thank you, Raymond
  5. Hi @Pat Stanford, It is the other way around. The first object drawn - at the bottom of the stack, yes - is returned by FSActLayer (or FActLayer, when selection is ignored.) The object at the top of the stack is returned by LSActLayer (or LActLayer, when selection is ignored.) Everything else is correct. Good night, Raymond 😉
  6. In the same vane as @Pat Stanford's example, but using abs(a-b <Tol) to combine the (a < b+Tol) and (a > b-Tol) into one expression, you will need three comparisons. This compares Rotation to Ang+0, Ang+180, and Ang-180, and tests them against a tolerance. Tol = 0.001 if (abs(ObjAng - Rotation) < Tol) or (abs(ObjAng - Rotation + 180) < Tol) or (abs(ObjAng - Rotation - 180) < Tol): I think this covers all options. Change the tolerance to change the sensitivity of acceptable values. If you want to include values at the tolerance limit, then use "<=" in place of "<". HTH, Raymond
  7. Hi @Pat Stanford, OOPS! Yes, Pref 21, not 12. Thank you. I corrected it above. It may be a bug, but as far as I can remember it has always worked this way. Annoying, it is! If you can get it scheduled to be "fixed", I and a lot of others will rejoice. Raymond
  8. You can use $INCLUDE statements in Palette Scripts, and in Plug-in Scripts. You can also set VW to recompile on each execution (VW Pref 21 – Developer Mode, or VW Pref 407 – ImmediateVSMode), but it is only "automatic" for scripts run inside Plug-ins. If you want to recompile a script that has an $INCLUDE statement in a Palette Script, then after you make changes to the disk file you will have to open the Script Editor for the script in the palette (Opt/Alt–Double Click) and then close the Editor with the OK button. No changes to the file are necessary. If you use the ESC key or click the Cancel button, nothing happens and the script will not be recompiled. If you have your $INCLUDE statement inside a Plug-in and set VW to recompile for each execution, VW will automatically recompile before each execution, so you can make edits in your disk file and rerun the Plug-in. Your disk changes will be recompiled. Bottom Line: The Automatic Recompile option for Palette Scripts is meaningless. It only applies to Plug-in scripts. HTH, Raymond
  9. Hello @MGuilfoile, Like you, I enjoy using the Screen Plane while drawing in 3D. If your problem in not related to the Clip Cube, how do you have your Document Preferences set for Legacy 2D drawing? I use the following settings and enjoy the older style of drawing that used to exist. I don't use Clip Cube, so I cannot comment on its interaction. Please write back and share your findings when you can. Raymond
  10. Hello @Jayme McColgan, I know less about this than you, but I am using the following line in my ResetEvent: vs.OLDAddLoadHangPoint(PIOHand, 0, InsP, FALSE); where InsPt is the PIO insertion point. Unless told otherwise, I believe FALSE declares it as a Point Load, and TRUE declares it as a Distributed Load. I doubt it will solve what ails you, but it is one more piece to an undefined puzzle. Any documentation, or usage examples, from the Mother Ship would be immensely appreciated. Raymond
  11. Hello @KingChaos, Without knowing more specifically what you want to achieve I can only give a basic response to your question. What I'm expecting from you is a description that you might give a scripting professional that you hired to do the work as you outline it. As an example (not reflecting your actual intentions): 1) Draw a 3D Polygon. 2) Use the center of polygon sides to create "extrudes". 3) Use "Depth" field in OIP to set extrude's depth. 4) Use "Extrude" field in OIP to set extrude's height. 5) Have a Button in OIP to save each extrude to a symbol and name it uniquely. (optional) 6) Have a Button in OIP to build Worksheet takeoffs from PIO. (optional) 7) Use Popup menu in OIP to apply Texture(s). (optional) The more detail you supply about each functional step you want, the better. Knowing how your OIP is supposed to be used to control your object will help us suggest what we would recommend you try. In a thread from December 2022 I posted a basic outline of the code needed for an Event-Enabled-PIO. This won't solve your problem, but it will show you what the outline of an event-enabled Plug-In might look like. Your specific code would need to be inserted into this shell to make it do anything useful. Here's the link: https://forum.vectorworks.net/index.php?/topic/103538-event-enabled-plugins-with-variable-number-of-parameters/#comment-452032 Raymond
  12. Hello @KingChaos, To give you an appropriate answer I need to know how your PIO is supposed to work. If you just draw a path and something happens, the PIO is relatively simple. However, if you you want to have controls showing in the OIP, like one or more buttons, checkboxes, radio buttons, popup menus, etc., then you will want an Event-Enabled PIO, and that is not a simple thing to describe. If you would, please describe how you want the PIO to work – what you will draw, what actions you want perform on the object after it's drawn, etc. The more detail you provide the easier it will be for me (us) to be specific. Thank you, Raymond
  13. Place your PIO in the drawing. Select it. Open menu Modify > Create Symbol..., name your symbol, and check the items circled in red. This creates a RED Symbol, which places a copy of your PIO in the drawing when you place the symbol. Your parameters will show in the OIP. Raymond Create Symbol Dialog.pdf
  14. If I was going to script my solid, I would probably use SubtractSolid() to make a shell. There is also the Shell Solid Tool, if you are drawing manually. To use SubtractSolid(), create an extruded solid, duplicate it in place, shrink the duplicate (and possibly move it to create an open carcass), then subtract it from the first solid. There are other ways to achieve the same result. You can also extrude the outer sides of the box, 5 or 6 sides, and use AddSolid() to each one sequentially to build up the same solid. You can also extrude the back, then extrude a hollow Polyline for the walls, and use AddSolid() to join them. If you have further questions on Solid Geometry, check out the SOLIDS MODELING AND 3D PRINTING section in Solids Modeling and Subdivision in this Forum. Everything you want to do can be done. Baby steps will you get there. When you get a routine finished in VS or Python, you'll be amazed how fast it will run. All the best, Raymond
  15. I forgot to ask, were you able to add the code above to a Point Object PIO? If you need help with that, just ask. Raymond
×
×
  • Create New...