Jump to content

matteoluigi

Member
  • Posts

    460
  • Joined

  • Last visited

Posts posted by matteoluigi

  1. 😞 that didn't help

    I just want to prevent, that the worksheet already exists before I create a new one 😉 

    for a in range (4):
    #	vs.CreateWS('WS_TEST'+a+',2,2')
    	worksheet = vs.GetObject(vs.Concat('WS_TEST',a))
        if worksheet not in [None, 0]:
    		vs.CreateWS((vs.Concat('WS_TEST',a)),2,2)
    	vs.SetWSColumnWidth((vs.Concat('WS_TEST',a)),1,1,50)
    	vs.SetWSColumnWidth((vs.Concat('WS_TEST',a)),1,1,20)
    	vs.SetWSRowHeight((vs.Concat('WS_TEST',a)),1,1,20,0,0)
    	vs.SetWSRowHeight((vs.Concat('WS_TEST',a)),2,2,20,0,0)
    	vs.SetWSCellFormulaN((vs.Concat('WS_TEST',a)),1,1,1,1,a)

    1496833676_Bildschirmfoto2022-02-20um23_08_18.thumb.png.9afad571f0355e24da3632ae2855017b.png

     

     

    create-ws.zip

  2. did you find any conclusion?

    actually I tried the following code, understanding that it won't work.

    However, I want to check wether the worksheet already exists before I create it.

    if worksheet = nil: however doesn't work with a handle, obviously (and "NIL" doesn't exist in Python)

    What can I do?

    switch back to Vectorscript? 😞  

    	worksheet = vs.GetObject('WS_TEST')
        if worksheet = nil:
    		vs.CreateWS(('WS_TEST'),2,2)

     

  3. yeah, now i digged out that script, too.

     

    Incredible somehow, that there is no "find and replace"-command in Vectorworks-Worksheets ;-D.

    Like Excel without find-replace...

     

    such a pity, that you can't find & replace sub-rows (unfortunately technically unthinkable, imho)

    • Like 2
  4. # this script reads out ther first column of a worksheet
    # in the first column are written all worksheet names which you might want to recalculate
    # so you can create more worksheets like more sets of worksheets to recalculate (like publisher sets in VW are possible, too)
    
    WSSet = vs.StrDialog(‘Which set of worksheets do you want to recalculate: ‘,’’);
    # for loop, which reads out the first column of the "recalculate set"
    for row in range (1,10):
    	WSSetH = vs.GetObject(WSSet)
    	WSName=vs.GetWSCellFormulaN(WSSetH, row, 1)
    # yes, it works ;-)
    	WSNameH = vs.GetObject(WSName)
    # recalculate a Worksheet    
    	vs.RecalculateWS(WSNameH)

     

    • Like 1
  5. I tried a little Python script for that issue

    (this script recommends at least one worksheet with a series of worksheet names which you want to recalculate in the actual file)

     

    # this script reads out ther first column of a worksheet
    # in the first column are written all worksheet names which you might want to recalculate
    # so you can create more worksheets like more sets of worksheets to recalculate (like publisher sets in VW are possible, too)
    
    WSSet = vs.StrDialog(‘Which set of worksheets do you want to recalculate: ‘,’’);
    # for loop, which reads out the first column of the "recalculate set"
    for row in range (1,10):
    	WSSetH = vs.GetObject(WSSet)
    	formula=vs.GetWSCellFormulaN(WSSetH, row, 1)
    # maybe "WSName=vs.GetWSCellFormulaN(WSSetH, row, 1)" works, too
    	WSName=formula
    	WSNameH = vs.GetObject(WSName)
    # recalculate a Worksheet    
    	vs.RecalculateWS(WSNameH)

     

    • Like 1
  6. Hi,

     

    a colleague does have problems pasting text from adobe reader 2021.011.20039 in VW 2021 SP5.

    He uses macOS 10.14 on a late 2015 27" iMac with 16GB of ram.

     

    (as you can see in the screenshot) the pasted text gets scattered somehow in pieces after copying it from a pdf and pasting it in a document.

     

    Any experiences?

     

    a9f4ee6b-5e7d-450c-bad9-d976a85ca98d.jpg

    • Confused 1
  7. Hi,

     

    actually I am looking for some help how to make a script run within a Vectorworks worksheet.

    Actually I know a little about scripting (both Vectorscript and Python) and what I am doing is simple data processing, which doesn't work in worksheets for several reasons.

    I actually wrote some scripts, which for example count space objects and sum up their are, in order to recalculate it in a new worksheet. However running scripts inside the datamanager sounds quite appealing, so it could be worth a try.

     

    Now my simple idea has been, that either if I work in a worksheet or the datamanager, the system must be quite similar

     

    1) in a worksheet for example I create a filter line, which shows me for example all space objects in the drawing or in a specific layer. In Column A I write ='Space'.'11_Occupancy Type' in order to see the text in the corresponding space object record format field. Now I want to hand over that text to a script in column B in order to do whatever I could do with the string from column A. Divide it into substrings, count all Space objects with the corresponding occupancy type and calculate their are,... (sounds quite like it could be possible within the worksheet, but, what I want to achieve goes a little bit further) however

    a) where can I define that I want to hand over the string from the worksheet cells A-1.1 -> A1.X?

    b) how do catch that string within the script

    c) and finally, how do I hand it over back to the worksheet?

     

    2) same about the Datamanager. Let's say, I create a new mapping, which reads out the occupancy type of all space objects and has to count all space objects of the corresponding occupancy type and map the result into a "ifc data field".

     

    thanks in advance for your answers.

    The developer reference was a little bit to short. I didn't find the answer there, unfortunately.

  8. Hi,

     

    I want to use a (potentially python) script within the vw 2022 Datamanager.

     

    I don't understand, how to tell, which parameters are handed over from the datamanager to the script and vice versa.

    I want to read out " 'Space'.'11_Occupancy Type'" in order to count how many rooms the apartment xy does have and how big it is (square meters).

     

    That's the quick help text which doesn't really help me a lot: 

    Quote

    Database header cell:
    =RunScript('My Script') executes the VectorScript script named “My Script” and returns a value for each object in the database

    Spreadsheet cell:
    =RunScript(2, 'ScriptFile.py', 2, 1) executes the Python script “ScriptFile.py” in the Vectorworks Plug-Ins folder, passing the parameters “2” and “1,” and returns a value
     

  9. 6 minutes ago, Nikolay Zhelyazkov said:

    You can use worksheets to get such information and put them on the drawing as shown in the attached file.

    yes, but worksheets actually can't solve what I want to do.

    I want to count how many apartments of which entire netto size and of which room number I have.

    I still didn't find, how to solve that in a worksheet without some "customizations" (Scripts)

     

    At all, a worksheet can count how many rooms every aparmtent has and how many square meters it has, too.

     

    If I want to count how many aparments of which type a bulding contains, I still have to re refer on space objects. So, writing the room number in a space object, for example with a data tag could be the solution. So, the only reason for that limitation imho could be a performance issue.

  10. Well, the Substring thing in fact wasn't my main Idea, however it was worth a try... And, I made it work 🙂

    #WS_TEILSTRING('Space'.'11_Occupancy Type'; '_'; 2)# (TEILSTRING is the German command for SUBSTRING 😉 )

     

    my next try is a little bit more advanced, and @Antonio Landsberger from ComputerWorks Germany already told me, that it won't work, and he already placed an Enhancement/Improvement Request (in Jira or somehwere else..., dunno)

     

    I want a Data Tag which counts the number of Space Objects with the same Flat/Apartment ID.

    So  I know, how many rooms a flat/apartment does have and how many square meters. I already did sth similar with a vectorscript and python script but, running that script takes about 4-10 Minutes, every time (of course dependent of the project size). So I thought solving sth like this with a Data Tag could be a smart way...

    (in fact I would have to count the number of rooms, which are either a living, sleeping or working room, but that's more a question of an if query 😉 )

    However, it's just another aproach, also for getting more and more familiar with the new data tag tool...

     

    (I tried counting Spaces with "#WS_ANZAHL('Space'.'11_Occupancy Type')#"  (Anzahl of course is the command for counting objects.) 

     

    Thanks in advance.

     

    Data Tag tests.zip

  11. imo we need a datamanager subforum here, the complexity of code increased since vw2022 a lot, it's neither 100% Vectorscript, nor Python (more VS but, too specific imho, many VS guys never get in touch with the datamanager however..., although it COULD BECOME a mighty tool for everybody, event designers included...)

  12. 23 hours ago, matteoluigi said:

    =Concat

    i finally made it. The command "TEXTJOIN" worked. Might sound a little bit weird for Vectorscript.

     

    At all, I only did post here, because I didn't know where else and I've been afraid that in the "Troubleshooting"-Board nobody really is interested in the datamanager...

  13. Hi,

     

    I actually am trying to code more complex things in the 2022 Datamanager. Sth like, "concatenate" the wall type.

    first part should scan of which material the wall is made, which we actually write in the wall style name. second part is sth like "is it a wall or what is it really? (also written in the style name) and last but not least wether it's an external or an internal wall.

     

    The result should look like:

    =Concat(IF(((Style.'Name')='*STB*');'Concrete';'other material');' wall ';(((Style.'Name')='*-A*');'external';'internal'))

     

    however the datamanager returns me bracket and comma-errors.

     

    First of all, is it now possible to concatenate a datamanager-mapping the way I describe it here, and, what could I do better?

     

    And, which forum could be better for issues like that? 😉

    I am afraid of getting no answer in the troubleshooting-board...

     

    thanks in advance!!!

×
×
  • Create New...