Jump to content

matteoluigi

Member
  • Posts

    464
  • Joined

  • Last visited

Posts posted by matteoluigi

  1. 26 minutes ago, JBenghiat said:

    SetRField will only accept field values as strings.

    Yes, I‘ve already solved that problem with three variables for one issue, the first is REAL or INTEGER, the second one is a STRING and the third one a ...CHAR variable, num2str converts my REAL or INTEGER into a STRING... works fine 

    thanks a lot 

    I will check out the rest tomorrow 🤗

  2. Did I understand right, that I have to pack two procedures in one script?

     

    like that:

     

    Quote

    PROCEDURE DB;

     

    VAR

     

    Variables: *****

     

    PROCEDURE CalledProc(HNDL:Handle);

    Begin

    SetRField(HNDL,'Wohnung','Whg-Typ’,’myvalue’);

    End;

     

    BEGIN

    FOR HNR:=1 TO 6 DO

    BEGIN

    FOR WHGNR:=10 TO 15 DO

    BEGIN

    ZANZAHL := COUNT((('Wohnung'.'Haus-Nr'=HNR) & ('Wohnung'.'Whg-Nr'=AptNr)) ;

    ForEachObject(CalledProc, (('Wohnung'.'Haus-Nr'=HNR) & ('Wohnung'.'Whg-Nr'=WHGNR));

    END;

    END;

    END;

    RUN(DB);

     

  3. 15 hours ago, Pat Stanford said:

    Since you said you want to use "database attributes" I think you mean Criteria

    oh, excuse me, I have been translating directly from german.

    I want to select objects by record fields and not by their names and assign new data to other record fields.

     

    Let's say, "get me all geometry(=rectangles, polygons,...)" who match "(('Apartment',Housing'=HNr) &('Apartment',Apartmentnumber'=ANr)) and assign the values for total-nr of rooms and total area to a record field in every room-geometry of this apartment...

     

    Somehow it seems to me, that it isn't possible to assign an object to a handle which is chosen by a record field and not by its name... (and now I try to limit myself to assigning single objects to that handle 😉 ) sorry for bothering

     

  4. Hi,

    sorry for bothering again 😉 but, you have been really of help!!! thanks a lot!

     

    i want to assign data to record fields of more objects. Is this possible?

     

    Or am I right when I say, that:

    - I can assign only one single object to a handle

    - I can only assign an object to a handle by its (in the Vectorworks-file) unique name?

     

    I`d prefer selecting more objects by database attributes and assign the data simultaneously to more than one object...

     

    Somehow I think, that I want to much, now. 😔 Do I?

     

    Thanks for you great help, anyway!

  5. Sometimes there are missing things in Vectorworks which are really elementary... like having a doorbell at home without a button at the entrance-door for ringing... nearly.

     

    Actually I'm wondering again, what the worksheet-"sum" function really is for, when it's just for adding more variables one to the other instead of calculating a sum of a defined area.

    In Excel the function does look the following way: "SUM(A1:A20)" and it does create a sum from the complete cell-content from cell "A1" to cell "A20".

    (https://support.microsoft.com/en-us/office/sum-function-043e1c7d-7726-4e80-8f32-07b23e057f89)

    could be a greatnew feature for Vectorworks 2022

     

    Maybe people don't need it very often, but, when you need this function, you really miss it.

  6. Is it really necessary, to create a new worksheet, everytime I run the script again?

     

    a) or can I "assign the worksheet to the handle in another way, too? (still looking for the way)

     

    b) is there any way, to check, wether a worksheet of a specific name already exists in the file?

     

    worksheet := CreateWS('Wohnungstypen-Auto', 5, 2);

     

    SetWSCellFormulaN(worksheet, zeile, 1, zeile, 1, inString);

  7. works nearly fine, however SetWSCellFormulaN only works with Strings or Char - Variables.

    I'd like to insert an Integer-Value.

     

    How could I do that? Is there any possibility to transform an Integer-Value into a String? Or feed a String-Variable with Integer-content?

     

    EINZW: INTEGER;

     

        inString := EINZW;          
        SetWSCellFormulaN(worksheet, zeile, 2, zeile, 2, inString);

     

     

  8. Hi,

     

    does there exist any possibility to write data from a Vectorscript-Script directly into an existing Vectorworks-worksheet?

     

    I didn't find a corresponding command. (maybe because the command doesn't exist)

     

    Alternative would be using "runscript" directly from the worksheet.

     

    Therefor I need to read out column A and insert it as variable in the script.

    (For example - A1: 1 -> "there are x 1-room-apartments")

     

  9. yeah, thanks, I got it all running, now 🙂

     

    Now I would like, to write my results in a worksheet.

     

    Still working on it (and maybe thinking about running the script within a worksheet)

     

    {In this script, I count
    
    a) how many objects are connected with the database "Wohnungsnummer" (number of flat/apartment)
    b) in a for to loop i do loop through all apartments (in fact the loop runs as often as many rooms are in the building, not as many apartments, but, that's not my main priority)
    
    - every loop the script counts the number of rooms which are living rooms, rooms or workrooms (it's the way you define flats in germany, a 3 room flat for example consists of a kitchen, a bathroom, a corridor, a living room and two sleeping rooms, you only count the living room and both sleeping rooms)}
    
    PROCEDURE zaehlen;
    
    VAR
    NR:			INTEGER;	{counter for the running loop}
    ANZAHL:		INTEGER;	{number of all rooms}
    ZANZAHL:	INTEGER;	{number of rooms of the actually checked apartment}
    EINZW:		INTEGER;	{number of all 1 room-appartments}
    ZWEIZW:		INTEGER;	{number of all 2 room-appartments}
    DREIZW:		INTEGER;	{number of all 3 room-appartments}
    VIERZW:		INTEGER;	{number of all 4 room-appartments}
    FUENFZW:	INTEGER;	{number of all 5 room-appartments}
    
    BEGIN
    ANZAHL := COUNT(((('Wohnung'.'Zimmertyp'='Zimmer')|('Wohnung'.'Zimmertyp'='Wohnen')|('Wohnung'.'Zimmertyp'='Arbeitszimmer'))));
    
    {EINZW :=0;
    ZWEIZW :=0;
    DREIZW :=0;
    VIERZW :=0;
    FUENFZW :=0;}
    
    FOR NR:=1 TO ANZAHL DO BEGIN	{Schleife, die alle Wohnungen "durchläuft" }
    
    ZANZAHL := COUNT(((('Wohnung'.'Whg-Nr'=NR) & (('Wohnung'.'Zimmertyp'='Zimmer') | ('Wohnung'.'Zimmertyp'='Arbeitszimmer') | ('Wohnung'.'Zimmertyp'='Wohnen')))));
    	{Zählt, wieviele Zimmerin der Wohnung sind mit der Wohnungsnummer NR.}
    
    IF (ZAnzahl=1) 	{erhöht den Einzimmerwohnungs-Zähler um 1, wenn die Whg ein Zimmer hat.}
    THEN
    BEGIN
    EINZW := EINZW+1;
    END;
    
    IF (ZAnzahl=2)		{erhöht den Zweizimmerwohnungs-Zähler um 1, wenn die Whg ein Zimmer hat.}
    THEN
    BEGIN
    ZWEIZW := ZWEIZW+1;
    END;
    
    
    IF (ZAnzahl=3)		{erhöht den Dreizimmerwohnungs-Zähler um 1, wenn die Whg ein Zimmer hat.}
    THEN
    BEGIN
    DREIZW := DREIZW+1;
    END;
    
    IF (ZAnzahl=4)		{erhöht den Vierzimmerwohnungs-Zähler um 1, wenn die Whg ein Zimmer hat.}
    THEN
    BEGIN
    VIERZW := VIERZW+1;
    END;
    
    IF (ZAnzahl=5)		{erhöht den Fünfzimmerwohnungs-Zähler um 1, wenn die Whg ein Zimmer hat.}
    THEN
    BEGIN
    FUENFZW := FUENFZW+1;
    END;
    
    END;
    
    
    CreateText(Concat('Da sind ', EINZW, ' Einzimmerwohnungen, ', ZWEIZW, ' Zweizimmerwohnungen, ', DREIZW, ' Dreizimmerwohnungen ', VIERZW, ' Vierzimmerwohnungen und ', FUENFZW, ' Fünfzimmerwohnungen.'));
    
    
    AlrtDialog(Concat('Da sind ', EINZW, ' Einzimmerwohnungen, ', ZWEIZW, ' Zweizimmerwohnungen, ', DREIZW, ' Dreizimmerwohnungen ', VIERZW, ' Vierzimmerwohnungen und ', FUENFZW, ' Fünfzimmerwohnungen.'));
    		{Gibt aus, wieviele Wohnungen welchen Typs im Haus sind.}
    END;
    RUN(zaehlen);

     

    • Like 1
  10. Quote

    IF COUNT((R IN ['Wohnung']) & ('Wohnung'.'Whg-Nr'=NR) & ('Wohnung'.'Zimmertyp'='Wohnen') | ('Wohnung'.'Zimmertyp'='Zimmer') | (('Wohnung'.'Zimmertyp'='Arbeitszimmer'))=1) THEN EINZW := EINZW+1;
    IF COUNT((R IN ['Wohnung']) & ('Wohnung'.'Whg-Nr'=NR) & ('Wohnung'.'Zimmertyp'='Wohnen') | ('Wohnung'.'Zimmertyp'='Zimmer') | (('Wohnung'.'Zimmertyp'='Arbeitszimmer'))=1) THEN ZWEIZW := ZWEIZW+1;
    IF COUNT((R IN ['Wohnung']) & ('Wohnung'.'Whg-Nr'=NR) & ('Wohnung'.'Zimmertyp'='Wohnen') | ('Wohnung'.'Zimmertyp'='Zimmer') | (('Wohnung'.'Zimmertyp'='Arbeitszimmer'))=1) THEN DREIZW := DREIZW+1;
    IF COUNT((R IN ['Wohnung']) & ('Wohnung'.'Whg-Nr'=NR) & ('Wohnung'.'Zimmertyp'='Wohnen') | ('Wohnung'.'Zimmertyp'='Zimmer') | (('Wohnung'.'Zimmertyp'='Arbeitszimmer'))=1) THEN VIERZW := VIERZW+1;
    IF COUNT((R IN ['Wohnung']) & ('Wohnung'.'Whg-Nr'=NR) & ('Wohnung'.'Zimmertyp'='Wohnen') | ('Wohnung'.'Zimmertyp'='Zimmer') | (('Wohnung'.'Zimmertyp'='Arbeitszimmer'))=1) THEN FUENFZW := FUENFZW+1

     

    however doesn't work

  11. @JBenghiat yeah, herbieherb already told me in the german user board 😉 I think about it. first i thought, I would feel more familiar with vector script, because I already have been coding in Vectorworks worksheets for a couple of years... however, just putting a "vs" in front is ok for coding python.

     

    great alternative, i guess, and of course keeping in mind that with marionette there exists a third alternative (which also includes python codes in its nodes)

×
×
  • Create New...