Jump to content

MullinRJ

Member
  • Posts

    2,024
  • Joined

  • Last visited

Everything posted by MullinRJ

  1. Sam, A new Group is always created on top of the stacking order, so if you are on a design or sheet layer, LActLayer will return a handle to a new Group. If you are drawing inside a container, you can use the Waldo method that Pat mentioned. With the handle you can then get the Group's BBox. Raymond
  2. @hagemeijer , Try 695, but note it is a Longint ObjVar. Raymond
  3. Samantha, "Sanctuary Floor Plan.vwx" and "Eaton Hall Floor Plan Renovations.vwx" do not appear to be VW files when opened with a text editor. They both start with headers that look like they may be AutoCAD files. "Sanctuary Floor Plan.vwx" starts with "AC1018" and, "Eaton Hall Floor Plan Renovations.vwx" starts with "AC1021". Change their file extensions to".dwg" and open them with AutoCAD, or import them into the program of your choice (that reads DWG files). The other two files are VW files. I'll let someone with better experience in doing DWG Exports help you there. Raymond
  4. Hi Sam, That's the change I thought would have the most impact on your problem, yet I'm not exactly sure what vsoStateAddCurrent() does under the hood. It's one of those things that works and I have not spent any time trying to figure out more about it. As you surmised, that is the only statement I have under that event in all of my PIO's. If you ever find another example on how it's used differently, please let me know. Happy New Year, Raymond
  5. Hi Sam, I have only two suggestions which I've marked with comments in your code. Try them one at a time to see if either of them works. Then try them together if neither works. After that, I'm out of ideas. GetVersion(Major,Minor,Maintenance,Platform); GetUnits(Fraction,Display,Format,UPI,UnitName,SquareName); Result := GetCustomObjectInfo(PIOName,PIOHan,PIORec,WallHdl); vsoGetEventInfo(EventMessage, MsgData); OK := GetLocalizedPlugInName(PIOName,LocalPIOName); IsNew := IsNewCustomObject(PIOName); BoxBottom := 3 * UPI; CASE EventMessage OF kResetEventID: { 3 } BEGIN { MOVE vsoStateGetParamChng LINE FROM EVENT 44 TO EVENT 3 } ParamChangeFlag := vsoStateGetParamChng(PIOHan,ParamChangeWidget,ParamChangeIndex,OldParam); GetSymLoc3D(PIOHan, PIOX, PIOY, PIOZ); ParamChangeFlag := vsoStateGetParamChng(PIOHan,ParamChangeWidget,ParamChangeIndex,OldParam); AlrtDialog(concat('Event 3, kResetEventID triggered', kcr, 'ParamChangeFlag = ', ParamChangeFlag, kcr, 'EventMessage = ', EventMessage, kcr, 'MsgData = ', MsgData)); IF (ParamChangeFlag=True) THEN BEGIN {Do Stuff} END; {IF (ParamChangeFlag=True) } ParamChangeTrig := FALSE; PIOChangeTrig := FALSE; SetUp; MainConstruct; vsoStateClear(PIOHan ); END; { 3 - kResetEventID } kObjOnAddState: { 44 } BEGIN {This event is needed to track state changes} { CHANGE EventMessage TO MsgData (x2) in following line } MsgData := vsoStateAddCurrent(PIOHan, MsgData); AlrtDialog(concat('Event 44, kObjOnAddState triggered', kcr, 'ParamChangeFlag = ', ParamChangeFlag, kcr, 'EventMessage = ', EventMessage, kcr, 'MsgData = ', MsgData)); END; { 44 - kObjOnAddState } kObjOnInitXProperties: { 5 } BEGIN Result := SetObjPropVS (kObjXPropHasUIOverride,True); Result := SetObjPropVS(12, TRUE); {kObjXHasCustomWidgetVisibilities} SetPrefInt(590, 1 ); {kParametricEnableStateEventing} Result := SetObjPropVS (18,TRUE); {kObjXPropAcceptStates} Result := vsoInsertAllParams; Result := SetObjPropVS(kObjXPropDataNameDisabled, TRUE);{kObjXPropDataNameDisabled} SetPrefInt (590,1); {varParametricEnableStateEventing,ResetStatesEvent} END; { 5 } kObjOnWidgetPrep: { 41 } BEGIN WidgetPrep; END; { 41 - kObjOnWidgetPrep } END; { case } Have a Merry Xmas, (or holiday of your choice), Raymond
  6. 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
  7. 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
  8. @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
  9. 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
  10. 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
  11. 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
  12. @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
  13. 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
  14. @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
  15. 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
  16. 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
  17. 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
  18. @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
  19. 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
  20. It looks like you forgot to add your DOIT procedure call before the criteria part. Raymond
  21. 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.
  22. 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
  23. @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
  24. Maxwell, Not all tools have index numbers. Not sure if this one does or doesn't. Raymond
  25. 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
×
×
  • Create New...