Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by MullinRJ

  1. Hi Sam, Do you have your call ParamChangeFlag := vsoStateGetParamChng(PIOHan, ParamChangeWidget, ParamChangeIndex, OldParam); in Event 3 (kResetEventID)? Everything else you have in your kObjOnInitXProperties event is what I have, though you call SetPrefInt(590, 1 ); {kParametricEnableStateEventing} twice, where I only call it once at the end of Event 5 (kObjOnInitXProperties). I doubt it makes a difference, but I don't know. Also, do you have "Event-Based" checked in the "Edit Plug-in Definition" dialog, Options tab? Lastly, I execute these 3 commands first before I enter the CASE statement testing the events: result := GetCustomObjectInfo(PIOName, PIOHand, recHand, wallHand); IsNew := IsNewCustomObject(PIOName); vsoGetEventInfo(theEvent, theMessage); The first line makes sure the PIOHand variable is valid, and the third line returns the current EVENT. Raymond
  2. Hi Andrea, You forgot to mention which version of VW you are currently using. Since the latest versions will open at least back to VW 2013, I saved your files in that format. If you need an earlier version, let me know. MC4 to VW2013 Files.zip All the best, Raymond
  3. @PatW , This may be related to a bug I filed in May (for regular VectorScript, not SDK) – (VB-160901) VS SetStaticTextColor() does not work in VW 2020. StaticText color assignment works is VW 2019, but not VW 2020. It still shows to be unresolved. Raymond
  4. To which release version are you referring? SP0 - it's broken. SP1 - is usually a release for localization changes and not bug fixes. SP2 - is not out yet. I expect it in this or SP3 at the latest. Just guessing here. As recommended above, I'd use VW 2019 for your designs needing this feature until VW 2020 is updated and working. The file(s) can be moved forward after it's working. I feel your pain. Raymond
  5. Nicolas, thank you. That is exactly what I was looking for. Usually I look at the HTML and the Dev Wiki pages for calls that are confusing or under documented. I missed this one. I guess it wasn't confusing enough. Now to find out why WriteXMLMemory() seems to work, yet kicks a -21 error (Invalid XML handle). Oh the joys of programming. Again, thank you. Raymond
  6. Does anyone know were a list of XML errors may be published? The following script was copied from the Developer Wiki from the VS:WriteXMLMemory() page. I modified it to trap any XML error generated along the way. On my computer running VW 2019 it generates an error for WriteXMLMemory(). The error is -21. Even with the -21 error, the function writes a value to variable "mem" which I display at the end of the program regardless of any errors. PROCEDURE test; VAR xml : LONGINT; err : INTEGER; mem : DYNARRAY OF CHAR; value : STRING; BEGIN mem := ''; xml := InitXML; err := CreateNewXMLDocument(xml, 'root'); if (err = 0) then begin err := SetElementValue(xml, '/root/value', '34'); if (err = 0) then begin err := WriteXMLMemory(xml, mem); if (err = 0) then AlrtDialog(mem) else AlrtDialog(concat('Error= ', err, ' in WriteXMLMemory()')); end else AlrtDialog(concat('Error= ', err, ' in SetElementValue()')); end else AlrtDialog(concat('Error= ', err, ' in CreateNewXMLDocument()')); err := ReleaseXML(xml); if (err <> 0) then AlrtDialog(concat('Error= ', err, ' in ReleaseXML()')); { Show value of variable "mem" w/ or w/o XML errors } AlrtDialog(mem); END; RUN(test); TIA, Raymond
  7. @rjtiedeman , Applying a FILL to an EXTRUDED Line was reported as a bug recently and now shows to be fixed. I assume the fix will apply to SWEPT Lines, too. I think this is only a temporary setback. Fingers crossed. Raymond
  8. Hi Pat, I did not draw the poly correctly. When I look at the drawing again I see the the thin pink line hugging the round walls. That definitely puts the right round wall OUTSIDE the poly by a distance of the wall's radius since, as you said, the round wall's center point is what is being tested. So, NO, it is not a matter of decimal precision. My bad. If someone wants to test the "solid" part of a round wall for inclusion in a Poly's interior, they will have to write a separate routine to test the endpoints and at least one point along the wall for inclusion. Doable, but tedious. The "LOC=" criteria is inadequate for this task. Just now I tested the straight wall, curious how it would test if one endpoint is OUTSIDE the Poly. It tested as INSIDE, until I pulled the endpoint enough that the center point of the straight wall was also OUTSIDE the poly. Then it tested as OUTSIDE. So it seems "LOC=" is only testing center points of objects for inclusion, and not edges. That's a significant caveat. Programmer beware!!! Here's another interesting scenario: draw a straight wall with both endpoints OUTSIDE the poly, so that only its center point is inside one of the poly's corners. It will test as being INSIDE using the "LOC=" criteria. Thanks Pat. Raymond
  9. @WhoCanDo, I mocked up your second drawing and it worked perfectly; one straight wall (68) and three round walls (89) were reported. The centers of the two exterior round walls were snapped to the Poly so they both tested to be INSIDE the Poly boundary. @Pat Stanford is correct about LOC using the arc center of the round walls for its testing. You might see a positional discrepancy if you changed your units to show 10 decimal places, but Real numbers in VW carry ~15 decimal places of accuracy, so it's possible that the center could be outside the Poly boundary by 3.8e-12 to 3.9e-11 drawing units and fail your test while not displaying a visible positional difference with 10 decimals displayed. This is where VectorScript (or VectorPython) can help you see what the OIP won't show. Displaying REAL values with the Message() or Concat() commands will show up to 15 decimals, if they exist. Try the following script and see if you can identify your problem. PROCEDURE test; { Name the Poly "Tmp", and select the rightmost RoundWall before running this script. } { If the RoundWall center is "outside" the BBox of the "Tmp" object, you will see different } { values in the first two lines of the AlrtDialog(), and the third line will return TRUE. } { If the delta between the values is <3.8e-12 units, the third line will return FALSE. } CONST CR = chr(13); VAR H :Handle; X :Real; P, Pc :Vector; BEGIN DSelectObj(N = 'Tmp'); { Pick round wall and get its Center point } HCenter(FSActLayer, Pc.x, Pc.y); { get Right Side X value of 'Tmp' object } X := RightBoundN(N = 'Tmp'); AlrtDialog(concat(' Right side of ''Tmp'': ', X, CR, 'Wall Center X Value: ', Pc.x, CR, CR, 'Wall Center is OUTSIDE the right edge of ''Tmp'' = ', Pc.x > X)); END; Run (test); HTH, Raymond
  10. You,re welcome. The name threw me, too – again. I knew it wasn't "Unified View" in the documentation because I've been down this road before, but I couldn't remember what it was. I searched for "view" in the documentations and that got me close enough to find it. Glad I could help. Raymond
  11. Hello Ken, This short two line script will toggle the Unified View ON and OFF each time it runs. It will also beep when Unified View is ON, which I use as auditory feedback for its state. SetPref(94, not GetPref(94)); { Toggle Unified View } if GetPref(94) then SysBeep; If you just want to set Unified View ON use: SetPref(94, TRUE); If you want to set it OFF use: SetPref(94, FALSE); HTH, Raymond
  12. The path always has one vertex (the 1st one) at the origin, like a Symbol Origin. In the drawing that origin point is the same as the insertion point of the PIO. Not sure if this helps. Raymond
  13. @Cadplan Architecture I was only stating the obvious and asking for more details about your query. You have provided very little to comment on, beside the direct question which I answered as did @bcd. You imply that someone, perhaps you, is having problems with VW 2019 under El Capitan, but no specifics are given, hence the request for more details. I hope our answers are satisfactory. VW runs very nicely for at least two of us under El Capitan. If you have a more specific issue I'd be glad to elaborate. Until then, Happy VectorWorking. Raymond
  14. I have not. Can you be more specific? I notice your signature shows OS 10.10.2 (Yosemite). El Capitan is OS 10.11.x. More details will make for more specific answers. Raymond
  15. It looks like you forgot to add your DOIT procedure call before the criteria part. Raymond
  16. Michael, Vectors are our friends. Perp(V); { is a 90° CW rotation } Perp(-V); { is a 90° CC rotation } UnitVec(Perp(V)) * aDistance; { scales the vector to exactly the distance you need } where "aDistance" is any real number. The position of the text is point P on your path (a Vector not a Point) + your offset vector (UnitVec(Perp(V)) * aDistance). So: Voffset := UnitVec(Perp(±Vtan)) * Doffset; { the distance between the path and the text object } Ptext := Ppath + Voffset; { the new position of your text object } where Ptext, Ppath, Vtan, and Voffset are Vectors and Doffset is a Real, and this assumes you already know Vtan, Doffset, and Ppath. You can also use SetTextOrientation() to position and rotate your text object. SetTextOrientation(H, Ptext.x, Ptext.y, Vec2Ang(Voffset), False); You'll have to play with your angles, but I bet you're only off by a multiple of 90°. HTH, Raymond PS - Embrace your Vectors, but not the pointy ends.
  17. Russell, I just finished a script in Python today that imports a 220 MB text file into a LIST (5,321,708 lines) - one text line per list element. I was able to do some serious parsing of the data (extracting names, searching for complex patterns, combining lines, and marking most for deletion), then write it out and back in to repeat the process a dozen times, all in under 35 seconds. This is not possible in VectorScript (VS), as the largest array in VS is limited to 32K elements. You're 12K item codes would fit into a VS array, but you'll have to code most of the routines you'll need yourself. Chances are, what you want to do is already available in Python as a set of canned routines. For many things, VS and Python are nearly equal in speed. But if you're going to do a lot of string manipulation, Python has way more text handling features than Pascal. It's worth the effort to explore the language. Also, there is a seemingly unending wealth of help sites and fora on the web for Python. Let Google lead you to the answers you seek. My 2¢, Raymond
  18. @josue Corona , I assume you mean to do this with VectorScript, considering where you posted your question? Here's a short script showing how to copy a view. The attached file shows the same thing, using the 1st design layer to set the view and a selected viewport to receive the view setting. You can use a similar approach to get the view rotations of a working plane by using the GetWorkingPlane() command. PROCEDURE xxx; { Example script to copy a Design Layer view and apply it to a Viewport. } { Select a Viewport. Run script. } { The script copies the view from the First Design Layer to the selected VP. } { 19 Jul 2019 - Raymond J Mullin } VAR Hdl, Hvp :Handle; procedure ApplyViewFromDLtoVP(Hdl, Hvp :Handle); { Copy the view from design layer (Hdl) to viewport (Hvp). } Var B :Boolean; Vr, Vc :Vector; Begin if (GetTypeN(Hvp) = 122) & (GetTypeN(Hdl) = 31) then if GetViewMatrix(Hdl, Vc.x, Vc.y, Vc.z, Vr.x, Vr.y, Vr.z) then B := SetViewMatrix(Hvp, Vc.x, Vc.y, Vc.z, Vr.x, Vr.y, Vr.z); End; { ApplyViewFromDLtoVP} BEGIN Hvp := FSActLayer; { handle to selected VP } Hdl := FLayer; { handle to an arbitrary design layer } ApplyViewFromDLtoVP(Hdl, Hvp); UpdateVP(Hvp); RedrawAll; END; Run(xxx); Not knowing what version of VW you are running I exported the file as v2016, (and for others using older versions.) Please add a signature to your profile. It really will help people answer your questions more accurately. Raymond Copy View from DL to VP v2016.vwx
  19. Maxwell, Not all tools have index numbers. Not sure if this one does or doesn't. Raymond
  20. Simon, I opened your file in VW 2014 and exported from there. I hope all of the pieces made it through. It looked pretty good when viewed in eDrawings, but check it carefully if you can. If you need a PDF to compare it to, just ask. 30710-A- Topographic Survey-Dwyer v2014.zip Raymond
  21. VW 2011 was the first version that accepted Carriage Return (CR) characters in the Message Window; and Windows and Mac have different codes to accomplish this. The Mac uses CHR(13) for a CR while Windows uses CHR(13), CHR(10). So for Mac: Message('Line 1', chr(13), 'Line 2'); and Message('Line 1', chr(10), 'Line 2'); and Message('Line 1', chr(13), chr(10), 'Line 2'); and for Windows: Message('Line 1', chr(13), chr(10), 'Line 2'); all produce the same output. ______________________________________ x + VectorScript Message ______________________________________ Line 1 Line 2 ______________________________________ HTH, Raymond
  22. @The Hamma , That would make perfect sense, but RegularPolygon() is one of those procedures that always takes its input as mm, and not document units. So, YES, you have to scale the inputs to be mm before calling RegularPolygon(). Unfortunately, the documentation does not reflect that. Welcome to the quirky world of VS programming. : ) Raymond
  23. Josue, The script @Pat Stanford showed you does not work when you are editing inside a Viewport's Annotation Space, nor inside any other container objects, i.e., Symbols, Groups, Profile space of 3D objects, etc. This is because of limitations of the FSActLayer function which only returns handles from selected objects on Design Layers and Sheet Layers. Do a search on "Waldo" in the Vectorscript Forum. You will get several hits that will show you a few lines that will return a handle to a selected object inside a container, like the Viewport's Annotation Space. Waldo is the nickname given to this kind of code that gets you a handle when you are not on a Design or Sheet Layer. Reference "Where's Waldo" to see where the name came from. Have fun and good luck, Raymond
  24. Pat, Is the toilet symbol only used in the Bathroom symbol, or does it exist in other symbols, or by itself on the drawing? Can you post a sample file? I doubt I could recreate what you've got from your description. Raymond


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...