Jump to content
Developer Wiki and Function Reference Links ×

How to select a existing HATCH within VScript?


Recommended Posts

Hello dear Ccroft, Alexandre, Raymond,

The discussion is going further on, I'm very pleased, and a read that maybe the procedure can be simplified ?

As I'm not an expert, I'm not sure and a little afraid to change the procedure below with the new proposals in the last topics.

But to test the whole thing I made some cavities more in this wall and it is still working !

But wouldn't it be easier, I think, if a script, could produce an text-file in which the script displays a list with all the vectorfills and their negative number currently used in a document. ( In that case you just have to fill in the number and there will be less problems with using the right spelling and language )

Maybe we could also rename the hatches like for example A001, A002, A003 > Z998, Z999. In that case you could make a document, draw all your hatches with their simplified names and save it as a stationary.

( In the beginning I was working with AddLayer ... but it is simple with a normal vectorfill but for complicated hatches you can have 50 layers in a hatch because every little piece of a line will be put in different layers. To much work to do write 50 times AddLayer ..... ).

Below you see what I changed, if someone feels the need to make it better don't hesitate, thanks.

Procedure CustWall; { USA in inches USE in centimeters }

VAR

Name:STRING;

Result:BOOLEAN;

Function GetVectorFillIndex(VFName :String) :Longint;

{ Return a VectorFill index # from a VectorFill name.}

{ Raymond M. - Texas 6 February 2003 AWDC Belgium, Alexandre Brazil,Ccroft Canada}

Var

Done, Match :Boolean;

I, VFCnt :Longint;

function UpStr(S :String) :String;

{ An upper string FUNCTION. }

Begin

UprString(S);

UpStr := S;

End; { UpStr }

Begin

VFCnt := NumVectorFills;

UprString(VFName);

I := 0;

Match := False;

Done := VFCnt = 0;

while not Done do begin

I := I + 1;

Match := UpStr(VectorFillList(I)) = VFName;

Done := Match | (I = VFCnt);

end;

if not Match then I := 0;

GetVectorFillIndex := -Name2Index(VectorFillList(I));

End; { GetVectorFillIndex }

BEGIN

PushAttrs;

ClearCavities;

PenSize(6);

PenPat(2);

AddCavity(TRUE, 35cm, 20cm, GetVectorFillIndex('A te slopen metselw.'));

{ is it good changing (Add ... GetVect....) by the sentence below ?}

{ AddCavity(TRUE, 35cm, 20cm, -Name2Index('hatch name')); }

PenSize(6);

PenPat(2);

AddCavity(TRUE, 10cm, 1cm, GetVectorFillIndex('A parament type B'));

PenSize(6);

PenPat(2);

AddCavity(TRUE, -1cm, -15cm, GetVectorFillIndex('A prefabbeton'));

PenSize(6);

PenPat(2);

AddCavity(TRUE, -25cm, -35cm, GetVectorFillIndex('Akkerbouw V geel'));

DoubLines(70cm);

PenSize(14);

PenPat(2);

SetZVals(0cm, 312cm);

FillBack(12); { backgroundcolor see VSFunctionReference.html or VectorScriptLG10H_ns.pdf or sol8intro.pdf }

FillPat(17); { background 17 pattern or 41 pattern or ... see references }

{Name:= 'My Special Hatch Below'; }

{Result:=SetVectorFillDefault(Name); }

{ default hatch to be used in background for the whole wall (further testing needed)}

PenFore(255);

PenBack(0);

PenPat(2);

PenSize(14);

PenPat(2);

CallTool(-208);

{ or other CallTools }

PopAttrs;

END;

Run (CustWall);

THANKS AGAIN

Link to comment

Please find hereafter a reply taht was posted in an other forum :

? SETVECTORFILL is a function so it returns a value, in this case a Boolean. You need a Boolean variable, such as my standard 'ok'. Then you need to get a handle to the object (eg. obHd := FSACTLAYER;) and assign a STRING to variable hatchName.

So, the syntax is

PROCEDURE SetHatchToSelection;

VAR

hatchName : STRING;

obHd : HANDLE;

ok : BOOLEAN;

PROCEDURE SetHatch;

BEGIN

ok := SETVECTORFILL(obHd, hatchName);

END;

BEGIN { - main program - }

obHd := FSACTLAYER;

ok := TRUE;

IF obHd <> NIL THEN BEGIN

DoAllTheOtherStuff;

WHILE ((obHd <> NIL) & ok)) DO BEGIN

SetHatch;

IF ok THEN ObHd := NEXTSOBJ(obHd)

ELSE ALRTDIALOG(CONCAT('No such hatch as ', hatchName));

END;

END

ELSE ALRTDIALOG('Nothing selected');

END;

RUN(SetHatchToSelection);

DoAllTheOtherStuff is one or more procedures to do the dialog and buttons or whatever.

This is just off the top of my head, but should be approximately right (except for parentheses and so on). The test for hatch existing above is not a clever one.

Petri Sakkinen

4D Form Architects

Melbourne, Australia

? from http://www.vectordepot.com/forum/

[Roll Eyes]

Link to comment

Hi Walther

To answer an earlier question....all you really need for what I think you're doing is something like:

Procedure CustWall;

VAR

Name:STRING;

Result:BOOLEAN;

BEGIN

PushAttrs;

ClearCavities;

PenSize(6);

PenPat(2);

AddCavity(TRUE, 35cm, 20cm, -Name2Index('hatch name'));

{repeat as needed for each cavity}

DoubLines(70cm);

PenSize(14);

PenPat(2);

SetZVals(0cm, 312cm);

FillBack(12);

FillPat(17);

Name:= 'My Special Hatch Below';

Result:=SetVectorFillDefault(Name);

PenFore(255);

PenBack(0);

PenPat(2);

PenSize(14);

PenPat(2);

CallTool(-208);

PopAttrs;

END;

Run (CustWall);

"-Name2Index('name')" will do for you what "GetVectorFillIndex" does.

It sounds like you are writing 10 or 20 little scripts, each to run one wall style and saving everything in a template. How's that going for you?

What you could do is use one script that works for everything,in any document and for any user anywhere.It would work from a dialog which would ask for input for the parameters for each cavity. The script would build a list of all the hatches present in the doc. and display that in pop-down lists for each cavity along with fields for size,etc.

I make this suggestion as a kind of challenge for you to work towards as you begin to learn vectorscript. As I said before, if I had any use for such a script I might undertake this myself.It's a fair bit of work.

Keep on scripting!

Charles

Link to comment

Hi Charles, how are you ?

Yes you're right, but we already have this script that works ONLY for walls in any document and for ARCHITECT users.

But I don't know if the plug-in has been produced by Nemetschek or the Belgian Distributor for the local market.

( I bought 3 licenses VW Architecture, European Dutch version, are they worldwide all the same ? ..... I don't think so !)

(( I could send you a screenshot of it )) [Roll Eyes]

( I will have to ask them, because before in VW8.5 we had two options that that doesn't exist anymore in VW9.53 ( let's hope it will appear again in VW10 Europe version ), it was the DTM digital terrain modeller and a tool to make combined light walls. The last tool was also able to give use the whole list and quantities with the used materials in the light wall ( plaster, wood or metal, insulation, ... ) )

I needed different scripts ( 10, 20, maybe more ) linked to a push button that gives me immediately the desired wall, cirkel, arc, ... filled with the right hatch, ... height, .... put in the right class, layer and so on.

Once you have made a script you can copy-paste it for use with other hatches. I think it is not a hard bit of a work, once you know that others could also take advantage of it and that the local distributor or Nemetschek are prepared to implement it in the next release or to learn from feedback of their users.

The final purpose in making drawings is to choose from the beginning the right concept or input, after that the output ( measures, export ( to spreadsheet, DWG, ... ), printing, properties, ...) will so much easier to distillate from the document.

It is indeed a challenge for me and maybe also others learning VS, translating ideas in a difficult language, learning from others in topics, forums and meetings. Exchanging ideas or scripts via this NNA forum is a powerful WWS (worldwidesupport) that we need to feed constantly.

The main thing for me is not creating scripts but to design houses and therefore VW is a powerful abordable application. And sometimes I have this feeling that I need a special kind of plug-in that mades it much easier for me to do my job.

I have that same challenge with FileMakerPro.

I will keep on scripting, ;-)

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...