Jump to content


  • Content Count

  • Joined

  • Last visited

Posts posted by MullinRJ

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



    • Like 1

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



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


  4. 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;
    	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()'));
    		else AlrtDialog(concat('Error= ', err, ' in SetElementValue()'));
    	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 }





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



  6. @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. }
    	CR = chr(13);
    	H :Handle;
    	X :Real;
    	P, Pc :Vector;
    	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));
    Run (test);



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




  8. 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);




    • Like 1

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


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



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





    PS - Embrace your Vectors, but not the pointy ends.

    • Like 3

  11. 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¢,




  12. @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 }
    	Hdl, Hvp :Handle;
    	procedure ApplyViewFromDLtoVP(Hdl, Hvp :Handle);
    	{ Copy the view from design layer (Hdl) to viewport (Hvp). }
    		B :Boolean;
    		Vr, Vc :Vector;
    		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}
    	Hvp := FSActLayer;		{ handle to selected VP }
    	Hdl := FLayer;			{ handle to an arbitrary design layer }
    	ApplyViewFromDLtoVP(Hdl, Hvp);		


       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.




    Copy View from DL to VP v2016.vwx


  13. 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'); 


    Message('Line 1', chr(10), 'Line 2'); 


    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





    • Like 2

  14. 6 hours ago, The Hamma said:

    This modification corrects the issue but it seems to me that if the points are read from HCenter as inches then they should be passed to RegularPolygon as inches.


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



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



  16. 2 hours ago, Ride said:

    Strange, it works through printing.  


    As it was explained to me recently by Gunther Miller, the PRINT menu command is supported by APPLE, and the EXPORT menu options are support by Vectorworks. Thanks for submitting the BUG.




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