Jump to content

MullinRJ

Member
  • Content Count

    1,261
  • Joined

  • Last visited

Everything posted by MullinRJ

  1. MullinRJ

    Extrude rectangle

    tismacfan2, You have defined "ab" and "db" to be REAL numbers. If I translate "Keuzelijst" correctly it means "pick list", or "pop-up" in the English version of VW. The value of "Pab" will be of type STRING, even if the data in "Pab" represents a number. All elements in a Pop-up list are of type STRING. You will have to use Str2Num() to make the assignment. TRY: ab := Str2Num(Pab); db := Str2Num(Pdb); Your parameter "Pd" should be a number as its type is Afmeting, or Dimension. It's possible the error on line #15 will go away when the errors on the previous lines are corrected. Raymond
  2. MullinRJ

    Extrude rectangle

    tismacfan2, I am not sure exactly what you want, but the following script will create a rectangular Extrude object of 0-height on the Layer Plane, but you must draw it in Top/Plan or Top view. Since it is already an Extrude, you can use the OIP to set its Extrude Height, and Bottom Z-value. If you want to use this as a Tool, a different approach will be needed. (i.e., more code). PROCEDURE RectExtrude; { Draw a Rectangle, convert it to an Extrude w/ ZERO height. } { Extrude height and Bottom Z value can then be changed in the OIP. } { The initial rectangle is drawn on the Layer Plane. } { This script works as expected in Top and Top/Plan views, } { but in other 3D views the rectangle shifts position. } { 7 Jan 2018 - Raymond J Mullin } VAR H :Handle; X1, Y1, X2, Y2 :Real; BEGIN GetRect(X1, Y1, X2, Y2); Rect(X1, Y1, X2, Y2); H := HExtrude(LNewObj, 0, 0); END; Run(RectExtrude); HTH, Raymond
  3. I've always used Cut, then Paste-in-Place (Cmd-X, Cmd-Option-V). Raymond
  4. MullinRJ

    Convert Objects in Symbol to ByClass

    Boh, There may be a more elegant way to remove the Attributes-By-Class setting for selected objects, but I can't find it. I can only do it by removing each attribute individually. Here's a script to that effect. This will work on multiple selected symbols, but not on nested symbols. If a symbol definition contains other symbol instancess, they will not be affected. You will have to run this script on instances of each symbol you want to convert. You can place them in the drawing, select them all, then run the script once. After this script is run, you will not see any differences in the symbol's appearance. The objects inside will have the same attributes as the classes they are in. However, if you then change the appearance of a controlling class, these symbols will not follow the new class appearance since their contents no longer are set By-Class. I hope this is what you were looking for. Raymond Procedure SymbolContentsNotByClass; { If the selected objects in a drawing are symbols, this script locates } { each symbol definition and converts all objects inside the definition } { to REMOVE the SetByClass option for all attributes. } { 21 December 2017 - Raymond Mullin } { This has been less than lightly tested. Pat Stanford recommends you use } { this on a copy of your primary file. No warranty expressed or implied. } { Use at your own risk. Do not operate heavy machinery while using this script. } { I concur. } VAR SymH, H: Handle; B, visibility :Boolean; thickBasis, angul, Opacity, PenOp, FillOp :Integer; style, Red, Grn, Blu :Longint; size, wydth, thickness :Real; BEGIN SymH := FSActLayer; while (SymH <> Nil) do begin if (GetTypeN(SymH) = 15) then begin { if it is a Symbol } H := FinSymDef(GetObject(GetSymName(SymH))); while (H <> Nil) do begin SetLW(H, GetLW(H)); SetLSN(H, GetLSN(H)); GetPenFore(H, Red, Grn, Blu); SetPenFore(H, Red, Grn, Blu); GetPenBack(H, Red, Grn, Blu); SetPenBack(H, Red, Grn, Blu); SetFPat(H, GetFPat(H)); GetFillFore(H, Red, Grn, Blu); SetFillFore(H, Red, Grn, Blu); GetFillBack(H, Red, Grn, Blu); SetFillBack(H, Red, Grn, Blu); if GetObjBeginningMarker(H, style, angul, size, wydth, thickBasis, thickness, visibility) then B := SetObjBeginningMarker(H, style, angul, size, wydth, thickBasis, thickness, visibility); if GetObjEndMarker(H, style, angul, size, wydth, thickBasis, thickness, visibility) then B := SetObjEndMarker(H, style, angul, size, wydth, thickBasis, thickness, visibility); { For VW 2016 and earlier, use the following for Opacity: } GetOpacity(H, Opacity); SetOpacity(H, Opacity); { For VW 2017 and later, use the following for Opacity: } { if GetOpacityN(H, PenOp, FillOp) then B := SetOpacityN(H, PenOp, FillOp); } H := NextObj(H); end; { while (H <> Nil) } ResetObject(SymH); end; { if } SymH := NextSObj(SymH); end; { while (SymH <> Nil) } RedrawAll; END; Run(SymbolContentsNotByClass);
  5. MullinRJ

    Vectorscript - ask for variable

    T, you are very welcome. One way to learn how the calls are organized is to view the DevWiki or the HTML (on your computer) references using the "View By Class" link (see pic). This will allow you to ignore the majority of calls that probably don't relate to the problem you are interested in solving. With more than 2600 VS calls, filters are highly recommended. Also, keep writing back. Someone is always awake and ready to answer questions. All the best, Raymond
  6. MullinRJ

    Vectorscript - ask for variable

    T, Here's an example of a short script using a pre-defined String Dialog to get you started. Modify to your heart's content. PROCEDURE abc; VAR default, result :STRING; BEGIN default := ''; result := StrDialog('Enter Leader text...', default); if not DidCancel then begin DSelectAll; SelectObj( INSYMBOL & INVIEWPORT & (PON='ID Leader') & ('ID Leader'.'TagText' = result) ); end; { if } END; Run(abc); It should read fairly straightforward, except for "DidCancel". Consider "DidCancel" as a global variable that is set to TRUE when a user closes a standard dialog box by pressing the OK button, and is set to FALSE when a user presses the CANCEL button. Word of future caution, don't use the word "DidCancel" as one of your variable or procedure names. ;-O HTH, Raymond
  7. MullinRJ

    ConvertToPolygon() - Resolution

    I don't mind at all. Add away. One thing to keep in mind, this conversion ratio works for a single curve segment, as a Circle, Arc, or Oval. For complex (multiple) curves, like those existing in a Polyline or Rounded Rectangle, the number of segments created using this relation is per curve. Raymond
  8. MullinRJ

    ConvertToPolygon() - Resolution

    Patrick, The resolution number is not linear, but makes transitions at powers of 2. The number of sides generated is also a power of 2. Conversion resolutions of: 0-7 yield 2 sides; 8-15 yield 4 sides; 16-31 yield 8 sides; 32-63 yield 16 sides; etc., up to 512 which yields 256 sides. Values higher than 512 all yield 256 sides. HTH, Raymond
  9. MullinRJ

    Vectorworks 2012 has stopped

    Roly, Try this link instead: http://www.vectorworks.net/support/downloads/product-updates HTH, Raymond
  10. MullinRJ

    ProgressDlg Calls

    Sam, Was this of any help to you? Have you tried it yet? No hurry, just curious. Raymond
  11. There are 3 characters to be aware of when typing "dashes": - Hyphen (also called Dash or Minus Sign), – en dash, and — em dash. In Western Mac OS encoding (single byte characters): Hyphen, ASCII 45, Hex(2D), Hyphen key en dash, ASCII 208, Hex(D0), Option-Hyphen key em dash, ASCII 209, Hex(D1), Shift-Option-Hyphen key In Western Windows Latin 1 encoding (single byte characters): Hyphen, ASCII 45, Hex(2D), Hyphen key en dash, ASCII 150, Hex(96), type Alt-0150 em dash, ASCII 151, Hex(97), type Alt-0151 In UTF-8 the Hyphen (Dash, or Minus Sign) is still #45, but the en dash and em dash are multibyte characters; Hex E2 80 93, and Hex E2 80 94, respectively. Art mentions, "Often the minus key is both hyphen and N-dash", as seen in Word. Actually Word substitutes an en dash for a hyphen when a hyphen is typed, and that is a user preference that can be set, like substituting "smart quotes" for the singlequote and doublequote characters. I'm not sure if this helps, but VW sees all three of these characters as being different and will sort them accordingly. Raymond
  12. MullinRJ

    Get Active LineStyle

    Patrick, I think FPenPat() is what you are after. The names are confusing. PenPatN() sets the active pen pattern (line style) for the document. FPenPatN() returns the active pen pattern setting of the document. GetLSN() returns the line style of the referenced object (by handle). SetLSN() sets the line style of the referenced object (by handle). HTH, Raymond
  13. MullinRJ

    Newbie Question

    And YES, -209 refers to the Symbol Tool.
  14. MullinRJ

    Newbie Question

    Michael, Look in the Vectorworks 201x Script Function Reference. There is an online copy at http://developer.vectorworks.net/index.php/VS:Function_Reference_Appendix#settool. There is an HTML version on your computer that can be found in the application folder; Vectorworks 201x -> VWHelp -> Script Reference -> ScriptFunctionReference.html. Look in Appendix E for SetTool-CallTool Selectors. All tool selectors will have negative numbers. Raymond
  15. MullinRJ

    Ye Olde Mini Cad Files

    Jim, If Art's link doesn't work, I'll be happy to convert them for you. I've got versions back to MC+2.0 running on a trusty G5. Raymond
  16. MullinRJ

    ProgressDlg Calls

    Hi Sam, Here's a script that works to move the progress bar 10 times, but does nothing useful. I split the process into 4 segments representing different portions of the progress bar (10%, 30%, 50% and 10%) each with 10% steps, though a simple process would have one segment of 100% with ten 10% steps. If you have questions, fire back. I'm too tired to go into any more detail right now. Have fun, Raymond PROCEDURE xxx; { Linear script showing how to move the Progress Bar 10 times. } { The "WAITs" simulate a longer process taking place. } { 2 Nov 2017 - Raymond Mullin } BEGIN ProgressDlgOpen ('Progress Bar Demo', False); ProgressDlgSetMeter ('REACTANCE (%):'); ProgressDlgSetTopMsg ('CAUTION! HIGH IMPEDANCE!'); ProgressDlgSetBotMsg ('RESISTANCE IS REDUNDANT!') ; ProgressDlgYield (0); { start at 0% } wait(1); ProgressDlgStart(10, 1); { first 10% } ProgressDlgYield (1); { Increment the progress bar } wait(1); ProgressDlgStart(30, 3); { next 30% } ProgressDlgYield (1); wait(1); ProgressDlgYield (1); wait(1); ProgressDlgYield (1); wait(1); ProgressDlgStart(50, 5); { next 50% } ProgressDlgYield (1); wait(1); ProgressDlgYield (1); wait(1); ProgressDlgYield (1); wait(1); ProgressDlgYield (1); wait(1); ProgressDlgYield (1); wait(1); ProgressDlgSetTopMsg ('THE'); ProgressDlgSetBotMsg ('END') ; ProgressDlgStart(10, 1); { last 10% } ProgressDlgYield (1); wait(1); { Next two lines not needed in VW 2017 & earlier } ProgressDlgStart(0, 0); ProgressDlgYield (0); wait(3); { Wait, so you can read last screen } ProgressDlgEnd; ProgressDlgClose; END; Run(xxx);
  17. MullinRJ

    ProgressDlg Calls

    Sam, When I get home tonight I'll post an example of a script I wrote. It took me a long time to figure out how to set it up. Hopefully I can remember how I got it running. It is very unintuitive, but it does work. Raymond
  18. MullinRJ

    How does vs.Message work?

    Dom, Actually, you can copy text from the Message window, but you have to use the COPY command in the contextual menu. Select the text in the MESSAGE window, Right Click, Copy ... Paste elsewhere (any way you like.) I assume it works on Windows as it does on the Mac, but I have no idea why CMD-C doesn't work in the Message window. I just checked back to VW 2013 and it works at least back that far. HTH, Raymond
  19. Martin, You are very welcome. Raymond
  20. MullinRJ

    2D Polygon from 3D Sketch-Up Import

    Claes, When using Add Surface, I have found that limiting the selection to 200-400 objects is optimal for throughput. There appears to be an exponential slowdown based on the selection count. Waiting for 1000+ objects to ADD is intolerable for me, so I select small groups and Add Surface repeatedly. When done, I select the whole object and Add Surface again, but this is invariably a significantly reduced object count. If the resulting reduced object has over 1000 pieces, I'll carefully select contiguous pieces and add those. Using this approach I can be done with a 30k object count in under 5 minutes where VW night easily take 30 minutes to a few hours to complete in one pass. Raymond
  21. MullinRJ

    Ungroup in VW2018 also removes the attached records?

    Pat, You're doing arithmetic after midnight (my time). You win. My mind is already mush. Please define "Late posts" – Are you counting posts after midnight, or posts we both try to answer? Who's the keeper of the tally? When did it start? What's the score right now? If this is a race from now to sunrise I think I'll concede – a good night's sleep vs. a beer; I'll gladly buy the beer ;-) Did I mention my mind is mush? Simple arithmetic - when it stops being simple, it's way past my bed time. That's been my litmus test for several decades now. It's how I tell myself I need to go to bed. g'night... Raymond
  22. MullinRJ

    Ungroup in VW2018 also removes the attached records?

    Pat, it figures you'd get here first. I posted an answer in an older post, a half a day late and 50¢ short. I really should read all posts before answering any. Raymond
  23. Martin, I am seeing the same behavior in VW 2017 and VW 2018 when ungrouping. If there is a record attached to a GROUP, I get a dialog asking if I want to attach the GROUP's record to the objects inside the group. Do you get this dialog when you ungroup? Did you ever click the "Always do the selected action" box? If you did and then pressed NO, that would explain why you don't get this dialog and your objects never get the GROUP's records when you ungroup. To reset this setting, go to VW Preferences under the Session tab and click the "Reset Saved Settings..." button. Pick how much you want to reset and click OK. HTH, Raymond
  24. David, As Jim stated above, the compiler in SP1 will accept the NBS character ( and maybe others ) without kicking an error. If you can wait a few days (I'm guessing here, based on Jim's "imminent" estimate) you won't have to edit anything. 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.

×