Jump to content

tom_shady

Member
  • Posts

    11
  • Joined

  • Last visited

    Never

Posts posted by tom_shady

  1. i need to query point data that is stored in an XML - the xml will look similar to

    test3.xml

     <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
    <geo>
    <cloud>
    	<vector>
    		<x>11</x>
    		<y>22</y>
    	</vector>
    	<vector>
    		<x>33</x>
    		<y>44</y>
    	</vector>
    </cloud>
    </geo> 

    this is queried with the following script

    PROCEDURE ReadXML;
    {Reads data from an XML file, draw a locus}
    CONST
    kAppFolder = 1;
    VAR
    hXML		: LONGINT;
    xmlFile	: STRING;
    result	: INTEGER;
    str1,str2: STRING;
    BEGIN
    UseDefaultFileErrorHandling(FALSE);
    hXML:= InitXML;
    IF hXML <> 0 THEN BEGIN
    	{init xml-libary}
    	xmlFile:= 'test3.xml';
    	{load file into memory}
    	result:= ReadXMLFile(hXML, kAppFolder, xmlFile);
    	{ask file}
    	result:= GetElementValue(hXML,'/geo/cloud/vector/x',str1);
    	result:= GetElementValue(hXML,'/geo/cloud/vector/y',str2);
    	{clear memory}
    	result:= ReleaseXML(hXML);
    	{draw locus}
    	Locus(Str2Num(str1),Str2Num(str2));
    END ELSE BEGIN
    	{error}
    	Message('Could not initialize XML reader.');
    END;
    END;
    Run(ReadXML);
    

    i?m using VW 10.5 the functions GetFirstChild(..) GetNextElement(..) are not defined -

    HOW can I query the second vector of cloud/ or more generally the second child of an element?

    IS there a special path-Syntax?

    eg ( not working)

    result:= GetElementValue(hXML,'/geo/cloud[2]/x',str2);

    ?

  2. WORKAROUND:

    Thanks to M. Braach - he told me the following work-around:

    a opend polygon/line with fillpat 0 has no area...

    FUNCTION IsPolyClosed(poly:HANDLE):BOOLEAN;
    {ask wether a polyline / Polygon is opend - returns false - or closed - returns true }
    VAR
    	oldFillPat : LONGINT;
    BEGIN
    	oldFillPat := GetFPat(poly);
    	SetFPat(poly,0);
    	IF HArea(poly) = 0 THEN IsPolyClosed := FALSE ELSE IsPolyClosed := TRUE;
    	SetFPat(poly,oldFillPat);
    END;
    

  3. i?m using SetRField() to change Parameters of a plug-in-object. How can i provoke the plugin to update ? There must be a undocumentated way with a GetEvent() - Funciton ? see Vectorscript Plug-In Editor -> Object Properties, Script Execution, With Script-Specified Events.

    How does GetEvent work?

    Where can i find a Documentation?

    Thanks

  4. i 'm trying to query the Edge-Visibility of the Segments of a Polygon, and indicate it with green (visible) and red (invisible ) Locus. It seems GetVetexVisibility returns wrong results.

    any idea to solve this problem ?

    Using Vectorworks 10.5, mac os x 10.4.8

    PROCEDURE PolyInfo;
    {query all vertex-pts of a polygon and draw a point with color according to VertexVisibility - select a polygon / polyline first}
    Var
    	poly : HANDLE;
    	n_vert : INTEGER;
    	i:INTEGER;
    	pt:VECTOR;
    BEGIN
    	{ get the handle to the selectet polygon}
    	poly := FSActLayer;
    	{ get the number of vertices in the path }
    	n_vert:= GetVertNum(poly);
    	FOR i:= 1 TO n_vert DO BEGIN
    		{select color according to Verte}
    		GetPolyPt(poly, i, pt.x,pt.y);
    		IF GetVertexVisibility(poly,i) THEN PenFore(6) ELSE PenFore(7);
    		Locus(pt.x,pt.y);
    	END;
    END;
    Run(PolyInfo);
    

  5. i found out the following: the pulldownmenuitems are created wenn the dialog is called with

    RunLayoutDialog(dialogId,drivedialog)

    drivedialog is your procedure, getting called while the dialog is displayed to the user

    Procedure drivedialog(item:Longint;data:Longint);

    RunLayoutDialog will pass item to drivedialog

    the first time drivedialog is called it will get the value SetupDialogC

    - this function isn?t documented ;-{

    within this call you can create the pulldownitems with InsertCoice()

    a example is given here:

    http://www.nemetschek.net/support/custom/vscript/example.php

    have a look at

    Align Selected Object

    hope this will help, even if this discussion is quite old...

    well google find?s this page first,

    seems there aren?t so many modern-dialog programmers...

    Tom

  6. the vectorscript debugger might offer more usability:

    layout:

    it would be great if the script field and the variable field could be predefined as two different windows.

    using two monitors it is horrible that the variabels are below the text field!

    reseved word:

    {$breakpoint} would be wonderful. insert a breakpoint at this location.

    {$MessageLastUsedVariablesWait 4, 20} also nice: this will Message the last 4 variables that have been used and display them, then wait for 20 seconds.

    will Do the same as:

    code:

    VAR

    a,b,c,d : INTEGER;

    BEGIN

    a :=1;

    b := 20;

    c := 300;

    d := 4000;

    Message('a ', a , ' b ', b, ' c ', c, ' d ', d);

    END;

    [/code]

  7. i?m developing a plug-in object at the moment.

    i use a lot of parameters.

    the problem:

    how can i oppress / prevent the update of the object ?

    in the object properties - window i can specify -> script execution -> script specified event.

    the info says ... must first call GetEvent

    i can?t find any documentation for the GetEvent - call, function or what it is.

    the problem:

    im using to parameters that are multiplied:

    e.g i want to draw a grid using the parameter PNCOLUMN and PNROW (number of columns , number of rows)

    PNCOLUMN = 10;

    PNROW = 1000;

    (now i draw 10000 polygons)

    if i change

    PNCOLUMN = 100;

    PNROW = 100;

    the object has also 10 000 polygons

    but if i change PNCOLUMN first

    vectorworks updates the object with 100 000 polygons, an my old computer gives me a coffee-break.

    - even if i don?t need them ??

    ---> i dont?t want vectorworks to update my object.

    i want a botton in the obj info palette, a menu-command or something like this

    called maybe update_vectorscript_object();

    how to do this ?

    if there is a information or reference just post the link -- thanks

    Many Thanks for your effort.

    [ 04-14-2005, 12:00 PM: Message edited by: tom_shady ]

×
×
  • Create New...