Jump to content

MullinRJ

Member
  • Content Count

    1,300
  • Joined

  • Last visited

Everything posted by MullinRJ

  1. MullinRJ

    Clearing Dialog pull down menu

    Sam, After reading Julian's comment I looked at your code and mine again; there is a difference. I always remove the 0th element (the element at the front of the list). Julian's way removes the last element every time. You are removing the element at the index counter, which is a moving target. Eventually, the list gets shorter than the index counter and you will receive a runtime error. You need to pick one of our two methods and you should be okay to proceed. Raymond
  2. MullinRJ

    Clearing Dialog pull down menu

    Sam, It looks like your code should work. Have you verified that "fieldCount" is > 0? If it is, are your "Dialog" ID, and your "kTargetData2BOList" constant correct? I use something similar in Reshaper, where GetChoiceCnt is a custom function that returns the menu size from GetChoiceCount(), just like yours. for I := 0 to GetChoiceCnt(dlogID, MenuItem)-1 do RemoveChoice(dlogID, MenuItem, 0); HTH, Raymond
  3. MullinRJ

    Symbols in PIOs...turn off 2D?

    Control the visibility of the parts with classes. Raymond
  4. MullinRJ

    Quitting & Closing the VW Program by Red Dot

    If you use individual drawing windows, like in the good old days – Red Dot. If you use the "Application Window" – no Red Dot. Toggle the "Use Application Window" menu item to see the differences. Of course, I'm only speaking about the Mac. HTH, Raymond
  5. MullinRJ

    Layers with Python

    Martin, A basic Plug-In object is a SINGLE object and it must reside on one layer. It can contain multiple parts, like a symbol or a group, but it is treated as ONE object. You can put the pieces in multiple classes, but not on multiple layers. It is possible to "cast off" objects to other layers as your Plugin code runs, but that is definitely not standard practice. You could run your code as a Menu Command and draw on separate layers. That is more akin to running code from a script palette. Write back if you need more direction. Raymond
  6. MullinRJ

    Layers with Python

    Martin, Try this script: import vs; vs.Layer('Screen - Panels') vs.Rect(0, 0, 1, 1) vs.DSelectAll() vs.Layer('Screen - Data') vs.ArcByCenter(1, 1, 0.5, -90, 270) vs.DSelectAll() It creates a layer and draws a Rectangle on it (and deselect it), then creates another layer and draws an Arc on it (and deselect it). How does this differ from your script? Raymond
  7. MullinRJ

    screen plane only

    Gentlemen, I posted this as a bug on January 1st. I was informed it is (or will be fixed) in a future release, but I don't know which one. Hopefully the next one. I was able to determine through testing that the bug only affects files saved in VW 2018, as files saved in VW 2017 open correctly in both VW 2017 and VW 2018. If you use a particular template file often, you could export it to VW 2017, resave it as a template file in VW 2017, then move the .sta file to your VW 2018 User Folder under the "Vectorworks/2018/Libraries/Defaults/Templates/" directory. Save your VW 2018 version of the .sta file in another folder. Of course if you already have a template file in VW 2017, you can drag a copy of it to your 2018 User Folder. As soon as the bug fix is released you can replace your template file to the VW 2018 version again. This won't correct the problem when you save and reopen regular files, but at least you'll start a new file correctly. HTH, Raymond
  8. MullinRJ

    2D Symbols always insert at the drawing origin.

    Obviously not known by everyone. Are there any "known" workarounds? Thanks, Raymond
  9. MullinRJ

    2D Symbols always insert at the drawing origin.

    Sorry Michael, no new ideas here. Questions, but no ideas. Does this happen in all files? Files created from a VW 2018 template? Blank VW file? Files converted from earlier VW version(s)? PageBased, or WorldBased symbols? Can you post a problem file here? Raymond
  10. MullinRJ

    2D Symbols always insert at the drawing origin.

    Michael, What is your Snap Grid distance set to? Menu "Tools -> SmartCursor Settings...", or CMD-8. If you have constraint "Snap to Grid" enabled, and the Snap Grid is LARGE compared to your screen area, you'll be placing symbols at the origin all day long, assuming the origin is visible in your drawing window. Of course Symbols won't be the only thing jumping to the Origin, every click will land there. Please write back with the answer when you find it. I doubt I guessed it. Raymond
  11. MullinRJ

    Issue with "Extrude Along Path"

    Hello Sam, Problem 1, either draw your 2D objects directly on the Layer (GND) Plane, or move them there after they are created. Problem 2, requires manual clean up. I modified your script to address both problems. PROCEDURE EAPOnGndPlane; VAR struc, struc1, struc2 :Handle; BEGIN Rect(-40, 40, 40, -40); SetObjectVariableBoolean(LNewObj, 1160, FALSE); { Move PathRECT to Ground Plane } struc1 := ConvertToNURBS(LNewObj, FALSE); Rect(-1, 1, 1, -1); struc2 := LNewObj; SetObjectVariableBoolean(struc2, 1160, FALSE); { Move ProfileRECT to Ground Plane } struc := ExtrudeAlongPath(struc1, struc2); Move3DObj(struc, 0, 0, 10); { elevate EAP } { Clean up } DelObject(struc1); DelObject(struc2); if (struc <> nil) then SysBeep; { APPLAUSE!!! } END; Run(EAPOnGndPlane); HTH, Raymond
  12. MullinRJ

    Snap to loci

    Yes. This script will toggle the SnapToLoci preference and set the MasterSnaps preference to the opposite state as the SnapToLoci preference. { Toggle VW Preference SnapToLoci, and BEEP when it's enabled. } { Also toggle the MasterSnaps preference OFF when SnapToLoci is ON, and ON when SnapToLoci is OFF. } SetPref(5, not GetPref(5)); { Toggle SnapToLoci pref } SetPref(1257, not GetPref(5)); { Toggle MasterSnaps opposite of SnapToLoci pref } if GetPref(5) then SysBeep; { Beep when enabling SnapToLoci pref } Of course, if you normally keep the MasterSnaps preference OFF, then you only need to toggle the SnapToLoci preference. HTH, Raymond
  13. Once again, THANK YOU!!! Raymond
  14. MullinRJ

    Auto generate dimensions script issue

    Hi Emily, To get an "orthogonal" 3D size, you must first unrotate a 3D object before using Get3DInfo(). I modified your script to do just that. I also merged your Num2StrF() statements into the SetRField() statements to shorten the script a little. PROCEDURE InputData3D; { Get 3D_Size and attach or modify a "PanelSizes" record with the info. } { 11 Jan 2018 - Emily L. - Original script works for unrotated 3D objects only. } { 11 Jan 2018 - R.Mullin - Unrotate objects before measurement, then re-rotate them. } CONST RECD = 'PanelSizes'; VAR h :HANDLE; W, T, D :REAL; Xcen, Ycen, Zcen :REAL; xRot, yRot, zRot :REAL; isMirrored :BOOLEAN; BEGIN h := FSActLayer; REPEAT if Get3DOrientation(h, xRot, yRot, zRot, isMirrored) then begin Get3DCntr(h, Xcen, Ycen, Zcen); { get 3D center } { unrotate 3D object } Set3DRot(h, 0, 0, -zRot, Xcen, Ycen, Zcen); Set3DRot(h, 0, -yRot, 0, Xcen, Ycen, Zcen); Set3DRot(h, -xRot, 0, 0, Xcen, Ycen, Zcen); Get3DInfo(h, T, W, D); { get 3D size } { re-rotate 3D object } Set3DRot(h, xRot, 0, 0, Xcen, Ycen, Zcen); Set3DRot(h, 0, yRot, 0, Xcen, Ycen, Zcen); Set3DRot(H, 0, 0, zRot, Xcen, Ycen, Zcen); { store data in attached record. } SetRecord(h, RECD); SetRField(h, RECD, 'Width', Num2Strf(W)); SetRField(h, RECD, 'Height', Num2Strf(T)); SetRField(h, RECD, 'Depth', Num2Strf(D)); end; { if Get3DOrientation } h := NextSObj(h); UNTIL(h=NIL) END; RUN(InputData3D); HTH, Raymond
  15. MullinRJ

    Extrude rectangle

    Pascal, From your original script, I assume you want to use "ab" and "db" as real numbers. The values stored in the Plug-in that you reference as "Pab" and "Pdb" are STRINGs. To use them as numbers you use the Str2Num() function. You need to leave the original type declaration for "ab" and "db" as REAL. So: VAR ab, db :REAL; ... BEGIN ab := Str2Num(Pab); { converts Pab from STRING to REAL } db := Str2Num(Pdb); { converts Pdb from STRING to REAL } ... This should make your code snippet compile. HTH, Raymond
  16. 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
  17. 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
  18. I've always used Cut, then Paste-in-Place (Cmd-X, Cmd-Option-V). Raymond
  19. 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);
  20. 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
  21. 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
  22. 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
  23. 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
  24. MullinRJ

    Vectorworks 2012 has stopped

    Roly, Try this link instead: http://www.vectorworks.net/support/downloads/product-updates HTH, 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.

×