Jump to content

MullinRJ

Member
  • Content Count

    1,478
  • Joined

  • Last visited

Everything posted by MullinRJ

  1. Sorry, I misread your post. I see you want 3DM files, not 3DS files. I don't believe there is a canned function that supports 3DM files. You might try: vs.DoMenuTextByName('Import Rhino 3DM (3D only)', 0) This call will present an Open File dialog, same as the menu item. Not sure if this helps. Raymond
  2. @oldluke Yes, check out the Script Function Reference, either in your application folder in the HELP directory, or online at the Developer Wiki at https://developer.vectorworks.net/index.php/Main_Page and use the search function. I find the one in the HELP folder much quicker to use, but often there are more comments in the online version. Use both. FUNCTION Import3DSFile ( fileName :DYNARRAY[] of CHAR; atOrigCoords :BOOLEAN; positionX, positionY :REAL ) :BOOLEAN ; def vs.Import3DSFile(fileName, atOrigCoords, positionX, positionY):    return BOOLEAN HTH, Raymond
  3. Martjin, You're welcome. Out of curiosity, what version of VW are you using? Raymond
  4. Or from a script: PROCEDURE RecalculateWS ( worksheet: HANDLE );
  5. Recalculate: any time you manually update a cell and press ENTER (or click the green √) the worksheet recalculates. Force Recalculate: under the FILE menu > Recalculate Active Worksheet, or Recalculate All Worksheets.
  6. @Martijn Wingelaar , The Rounddown() worksheet function exists from VW 2018 to the present. In your example code you are using a semi-colon between the first and second arguments, instead of a comma. This may be causing your error if you entered it into VW that way. Caveat: there appears to be a difference in the way Rounddown() works between Excel and VW. In VW, Rounddown(NUM, 0) rounds numbers to the more negative integer if there is a non-zero fractional part. In Excel Rounddown() rounds toward zero. The difference in Excel between Rounddown() and Round() is that Rounddown() allows you to specify the number of decimal digits to keep where Round() does not. If you want the Excel functionality of Rounddown(NUM, 0) you can simply use the Round(NUM) function in VW. It always truncates the number to the closest integer toward ZERO. However, if you want a true Rounddown() function in a version of VW older than VW 2018, then you can use a modification of this formula: =IF(NUM-INT(NUM)<0, INT(NUM)-1, INT(NUM)) # rounds numbers with fractions to the nearest integer that is more negative than the number. if you are wanting to specify decimal accuracy greater than "0" digits, the formula will become a bit more complicated. I'll leave it to minds more curious than mine to try their hand at it. HTH, Raymond PS - If you would kindly include your version of VW, and your platform / OS combination in your forum signature, it will help forum members answer your questions more accurately and often faster. Thank you.
  7. @CW2020 , I think you should look under the Gear Icon in the upper right of the VW window for control of the Floating Data Bar: HTH, Raymond
  8. Hi Sam, What Pat said. If you still need to call, please feel free at any time. Raymond
  9. Hi @Taproot , You have a good eye, but there is not an easy way in VS to describe how to determine the font assigned to a text block. Rather than try to guide you through it, I made the changes to the previous script and posted it below. As you can see, it still took me about an hour to do this and I still took the easy way out by only checking the first character of a text block to check the font assignment. See next paragraph. I modified the previous script to only change the font type of Arial text blocks. You can specify the font to be changed by changing the constant "kFontNm" at the top of the program. There is one caveat, this script assumes that if a text block starts with a character in the Arial font, the whole text block is Arial. This script does not change individual characters within a text block. That can be done, but requires a bit more time to code. <<< THIS SCRIPT IS LIGHTLY TESTED — VERY LIGHTLY TESTED. USE AT YOUR OWN RISK, AND PLEASE TRY IT ON A TEST FILE FIRST. >>> Also, I corrected a mistake in the previous script that did not pass back the point size in variable "PointSize" from the FormatTextDialog() procedure. That is now corrected in the above script and in the one posted below. If anyone finds any problems with this script, please write back and I'll have @PatStanford get right on it. 😉 PROCEDURE ChangeSomeFonts; { Changes the font of all text on a drawing to the selected font } { Traverses into groups, symbols and viewport annotations } { January 6, 2012 } { © 2012, Coviana, Inc - Pat Stanford pat@coviana.com } { Licensed under the GNU Lesser General Public License } { 17 February 2020 - R. Mullin } { Added ability to set the Point Size of all text objects at the same time. } { Same GNU License as above. } { 7 October 2020 - R. Mullin } { Only change Text Blocks with name specified in constant "kFontNm" to target font name "kNewFontNm". } { Same GNU License as above. } CONST kFontNm = 'Arial'; { change from this font name } VAR Hd :Handle; NewFontNm :String; FontID, dummyInt :Integer; PointSize, dummyReal :Real; Procedure ChangeFont(Hd :Handle); Var FID :Integer; Begin if (GetTypeN(Hd) = 10) then begin FID := GetTextFont(Hd, 0); { assumes all characters in txtBlk are the same fontID } if (FontID = FID) then begin SetTextFont(Hd, 0, len(GetText(Hd)), GetFontID(NewFontNm)); SetTextSize(Hd, 0, len(GetText(Hd)), PointSize); end; { if (FontID = FID) } end; { if GetTypeN() } End; { ChangeFont } BEGIN FontID := GetFontID(kFontNm); { existing FontID } FormatTextDialog(NewFontNm, dummyInt, PointSize, dummyInt, dummyReal, dummyInt, dummyInt, 60); ForEachObject(ChangeFont, INSYMBOL & INOBJECT & INVIEWPORT & ALL); END; Run(ChangeSomeFonts); HTH, Raymond
  10. On further thought, have you looked at the CLIP commands? They might do what you are looking for. ClipPolygon() ClipSurface() ClipSurfaceN() HTH, Raymond
  11. Hi @josue Corona , There is not a single command that will do that. There are commands in the VS language that will return intersection points between objects: LineCircleIntersect() LineEllipseIntersect() LineLineIntersection() EllipseEllipseIntersect() And there are other commands that will determine if the points in question are on Line segments, or Arc segments: PtOnArc() PtOnLine() But to use these the way you are probably hoping for will require a fair amount of coding to take the points they return and manipulate your target object to break at the right spots. If you like Analytic Geometry you can get there from here. If not, you might consider hiring someone who does. Not sure if this helps, Raymond
  12. @WhoCanDo , I don't know what changed with the DMTBN() command. However, there are 32 new VS commands in VW 2021 that interface with Excel files. I have not used them so I cannot comment on them beyond their existence. Perhaps you can loop through your Worksheet's cells and export each cell to an Excel file. It seems more tedious than simply exporting to a text file, but it may give you more control. If you're lucky, @Pat Stanford has dabbled with these and can shed some light. These are the commands listed in the Script reference. Documentation is what you'd expect – thin. Excel_Convert EXL_AddSheet EXL_CloseBook EXL_DeleteSheet EXL_GetCellAlignment EXL_GetCellBordeDiff EXL_GetCellBorderB EXL_GetCellBorderL EXL_GetCellBorderR EXL_GetCellBorderT EXL_GetCellFill EXL_GetCellFont EXL_GetCellStyle EXL_GetCellValue EXL_GetSheetCnt EXL_GetSheetIndex EXL_GetSheetName EXL_GetSheetSize EXL_IsCellValid EXL_NewBook EXL_ReadFile EXL_SaveAndCloseBook EXL_SetCellAlignment EXL_SetCellBorderB EXL_SetCellBorderL EXL_SetCellBorderR EXL_SetCellBorderT EXL_SetCellFont EXL_SetCellNumber EXL_SetCellNumFormula EXL_SetCellStrFormula EXL_SetCellString Good luck, Raymond
  13. Gentlemen, Please check out this page in the VW Help. It's the only place I know that lists the WS Functions. https://app-help.vectorworks.net/2021/eng/index.htm#t=VW2021_Guide%2FWorksheets%2FWorksheet_functions.htm%23XREF_16089_Worksheet_Functions Raymond
  14. Hi @Sebastiaan , I'm seeing that. After too much trial and error, I've come to the same conclusion. Oddly, this works to show all 40 of the LDs'. =DATABASE((NOTINREFDLVP & NOTINDLVP & (PON='Lighting Device') & ('Lighting Device'.'Channel'>'0'))) BUT, this does not work as expected: =DATABASE((NOTINREFDLVP & NOTINDLVP & (PON='Lighting Device') & ('Lighting Device'.'Channel'>'1'))) It only shows LD's with channels 3-9, and 20. What I've noticed is that the DATABASE() engine is comparing strings, and not numerical values (as you'd like). Strings starting with "2xxx" through "9xxx" satisfy the equation, but strings "10" to "19" and "101" to "120" don't satisfy it because the first character in each string is a "1". You really need a VALUE() function, and that only appears to work in a worksheet cell, and not in a Database row. Sorry, I'm stumped. Raymond
  15. @Sebastiaan , Like Pat, I don't have a file to test this, but if a LD does not yet have a channel then this might work. =DATABASE( (NOTINREFDLVP & NOTINDLVP & (PON='Lighting Device') & ('Lighting Device'.'Channel'<>'') & (VALUE('Lighting Device'.'Channel')>=1) & (VALUE('Lighting Device'.'Channel')<=100)) ) This expression checks for an empty channel string before it tests the values in the channel HTH, Raymond
  16. Hi @matteoluigi , You can get the handle to any named object using GetObject() like this: H := GetObject('Wohnungstypen-Auto'); if (H <> nil) & (GetTypeN(H) = 18) then begin { type 18 = Worksheet } { do worksheet stuff here } end; { if } It is always wise to check a handle's validity and type before using it. HTH, Raymond
  17. @matteoluigi , There is a problem with your syntax of the 6 IF statements. Where you have " ))=1) " you should have " ))) =1 " Your last parenthesis should be to the left of the "=". The syntax is essentially " COUNT ( ... ) = aNumber ". Yes you can have statements lilke: if ( ) then begin end else if ( ) begin end else if ( ) begin end else begin end; Notice there is only 1 semicolon at the end, and not after each else if clause. HTH, Raymond
  18. I knew someone (@Pat Stanford) would have an elegant way to get inside. Thanks, Pat. Raymond
  19. Using: Message(GetTypeN(FSActLayer)); If I select a free standing Door I get type 86 (Plug-In object). If I select a a Door in a Wall I get type 68 (Wall object). To see the Door on a test wall I have in an open document, I needed to use: Message(GetTypeN(NextObj(NextObj(NextObj(NextObj(NextObj(NextObj(NextObj(FIn3D(FSActLayer)))))))))); As you can see, the door object is deep inside the Wall object. The number of objects in front of it are not exact, and are determined by the wall's construction. You should use a loop to look for the Door, or possibly try ForEachObjectAtPoint(). There may be a more direct way to get to the Door-in-Wall that someone else can point to. I've just done a cursory quick dive at this. Again, make sure your handle is pointing to a Door object before trying to access its record. HTH, Raymond
  20. Are you sure you have a handle to the Door and not the Wall? Raymond
  21. @Paolo , I did a quick test and it looks like the function HasPlugin() only returns TRUE if you have the plug-in installed in your workspace. Loading a plug-in after you have a resource/object of the same name will cause a conflict, but I don't know how VW responds in that scenario. I can only assume it causes more confusion. Raymond
  22. @Pat Stanford , You must know, as I do, that you have to get up pretty early if you want to beat @Pat Stanford to the post. 😉 LOL, Raymond
  23. Hi @Paolo , No, Plug-in names use the same name space as custom objects that you name manually, or by script. The only name space that I know of that is managed separately are the Layer Names. You can have objects, like Symbols, with the same name as a Layer and VW will not raise a conflict. I know this is confusing, but you are now on the right track. Raymond
  24. @herbieherb , It requires accessing two preference numbers – 45 & 6728 – to determine or set the current NavGraphics State. Use GetPref() and SetPref() to read and set these parameters respectively. If you still need help writing your script, please write back. Raymond

 

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