Jump to content

MullinRJ

Member
  • Posts

    2,004
  • Joined

  • Last visited

Everything posted by MullinRJ

  1. Don, ???Are you in a Rotated Plan View? If so, this is a known bug. I believe it will be fixed in the next SP release. Raymond PS - If you would, please fill out a signature that lists your machine specs and VW version information. It will help others answer you more quickly without having to ask the obvious first questions. Thanks - R.
  2. No, User Functions will not slow down a PIO's regen time, especially if they are not executed. Poorly written one's will, as will ones that contain a lot of loops, or ones that search through a lot of objects, etc. If you are worried about file size, you could split your functions by type, but you'll have to be careful about the order they load. In Pascal, a function must be defined before it is called. Another thing you could do, when you are finished developing a PIO, make a copy of everything in another folder and remove all the code you don't use. Then compile it so everything gets copied into the PIO. If the files end in .px a copy of the code will be loaded into the PIO and it will be stand alone. Keep your original files with all the $Included files so you can make easy changes. You'll have to read more about it in the VS manual to get a better feel for your compile options. Raymond
  3. How many UNDO levels have you specified in your VW Preferences? How many objects do you have in your file? If both numbers are large, that might explain the slowdown. Closing the file and restarting the program erase your history and speed things up. This is not the only cause of a slowdown, but it's a predictable one. To test, set your undo count to 0 or 1, close the Preferences dialogue, then reset your count. If things speed up, that's probably it. If you can live with a lower number, try it. I use 20 and rarely, if ever, see unexplained slowdowns. Your mileage may vary. Raymond
  4. Another thing to note, the color space for RGB is not 0..255, but rather 0..65535. You can convert easily by multiplying each 0..255 value by 257. As TBE points out, you need to get a handle to your object. The easiest one is FSActLayer. It can get much more complicated if you want your script to work off the active layer, but for most uses H := FSActLayer; will work. Raymond
  5. Hi David, If you send me the files offline, I would be happy to update them to the version of your choosing. (mullinrj@aol.com) I keep all the older versions on a G4 running OS9 for just such an event. Raymond
  6. Vlado, ???I'm having an inordinate amount of trouble getting meaningful data from objects with the standard 2D VS calls. With all the new drawing environments there needs to be an easier way to get and set object parameters to get what you want. ???This started to become a problem in VW 2008 with the introduction of the Rotated Plan View (RPV), but has escalated to a nightmare. Now with Screen Plane, Layer Plane and 3D Plane objects - in conjunction with the RPV - there isn't one call that returns consistent data in all combinations of the above. Move the User Origin and you're in for a mind altering experience. Raymond
  7. Thank you, Vlado. Raymond
  8. Justin, ???Your way should work. I think it's a bug. This will do the same thing, without the elegance of concise code. Procedure MyDuplicate; Var Boo :Boolean; Htemp, GrpHnd: HANDLE; BEGIN BEGINPOLY; Moveto(0, 0); Line(100, 0); LIne(0, -100); ENDPOLY; Htemp := LnewObj; GrpHnd := nil; BEGINGROUPN(GrpHnd); Locus(0, 0); { dummy object } ENDGROUP; Htemp := Hduplicate(Htemp, 100, 0); Boo := SetParent(HTemp, GrpHnd); { move inside group } Htemp := Hduplicate(Htemp, 100, 0); { dups stay in group } DelObject(FinGroup(GrpHnd)); { Delete locus } Message('Htemp: ', Htemp, ' Group: ', GrpHnd); END; RUN (MyDuplicate);
  9. Try using the Save View command. You can set View, Layers and Class visibilities with names that mean something to you. Switching is just a double click away. Cmd-Shift-Period and Cmd-Shift-Comma are even faster. Raymond
  10. Sean, ???Yes, you can have a larger radius at a vertex than one that would fit. VW will draw the smaller one in such a case. You can set a value with VS, or manually apply a larger value with the 2D Reshape tool (2nd mode button in the first group, and 4th mode button in the second group). One way to get there without realizing it is to have a larger Polyline and shrink it. VW does not adjust the radii after the shrink, it just draws the smaller of the programmed value, or the largest value that will fit. ???Where you'll run into problems is when you use VS to query the radius value and it tells you 10, because that's what's programmed, but really it's 6, because that's the largest radius that will fit. There's a lot of math needed to ferret out the 6 value if you intend to KNOW what the actual value is in a program. If you just want to see the value, the OIP will display the correct radius if you step through the vertices and look at the radius. NSITH*, Raymond * Not sure if this helps
  11. The safest way I've found is to create a plugin with one line: {$INCLUDE \Your\script\file\pathname\here } Also, set VW Preference 407 to TRUE, which you can toggle with a script or with menu Tools > Scripts > VS Compiler Mode. This tells the compiler to recompile your code each time it is run. Use any text editor to make changes. You don't even have to close your editor window, just save after your changes and run again. Reshaper is over 1MB in source code and has 55 $INCLUDES. No signs of hitting any limits yet. This works equally well for menu commands, tools and plug-in objects. When you are done developing, you can have the compiler copy all your code into your plugin for distribution, or you can leave it as a multi-file $INCLUDE'd collection. The choice is yours. Raymond
  12. You can also use the Sweep command, which is also under the Model menu. Place a locus to the side of the object you want to sweep by at least the radius of the cylinder you want it to wrap around. This assumes you want it wrapped around the outside of the cylinder Select both the locus and your object and invoke the Sweep command. To get it to spiral up, enter a positive value for the pitch. For the number of wraps, enter 360 * 7 (for 7 full turns). This saves you from having to do the math in your head, or elsewhere. Render in OpenGL or better to see it as a solid. You may have to assign colored fills to see detail. Raymond
  13. In your Event Loop, the variable ITEM identifies the exact control that was pressed. You can trap it with: case item of ???1: begin end;???{ OK Button } ???2: begin end;???{ Cancel Button } ???21..40: begin ???{ do stuff here if control 21 - 40 gets pressed } ???end; end;???{ case } This will work even if you only populate 15 of the 20 possible control numbers. HTH, Raymond
  14. Preston, Are you using PASTE, or PASTE IN PLACE? The latter keeps items registered even when pasting on layers at different scales. Also, you can change the scale of any layer at any time and not lose your registration. Lastly, are you importing DXF Layers as CLASSES (default) or as LAYERS? That setting is under the Graphic Attributes tab, which you will find behind the Set Custom Options... button if you are importing multiple DXF/DWG files at once. If you use the As Layers option it should split your data to design layers for you. HTH, Raymond
  15. Hi Who, You can get the handle of the 1st object in a group with: ???h2a := FinGroup(GrpHand); and get a handle to the next object in the group with: ???h2b := NextObj(h2a); If they happen to be Polys, so much the better. OR, you can duplicate the group with: ???Grouplic8Hand := hDuplicate(GrpHand, 0, 0); OR, move pieces into a Group with: ???boo := SetParent(h2, GrpHand); or out of a Group with: ???boo := SetParent(h2, GetParent(GrpHand)); If you want to merge the two polys in your group into one (assuming they overlap), you might use: ???h3 := AddSurface(h2a, h2b); and then ungroup it with: ???hUngroup(GrpHand); I'm not sure which approach, if any, would work for you. I'll let you pick. Have fun, Raymond
  16. Mr. Gog, You are going to run into trouble if Get3DOrientation() ever fails. In such a case, your code will never move to the next object and will wind up in an endless loop. You need to put H1:=NextSObj(H1); outside the IF statement and place it as the last statement in the WHILE loop. Raymond PS - Why did you create inline code and not use a user defined function? For small programs such as this, it's not a real issue, but as soon as you get up to 50 lines or more, user defined procedures and function will make the main body of your code read much more easily. In the following example, the main routine becomes 3 lines inside the WHILE loop: generate a random number, scale the object by that number, get the next selected object. In a year or two, which version of the script do you think will be easier to read? Procedure RandomScaleSelected; { Scale selected 3D objects by a random factor between 0.6 and 1.0 } Var ???H1: Handle; ???R1: Real; ???procedure ScaleIt3D(H :Handle; SF :Real); ???{ Scale a 3D object around its center by scale factor SF. } ???Var ??????mirror :Boolean; ??????X, Y, Z, Xrot, Yrot, Zrot :Real; ???Begin ??????if Get3DOrientation(H, Xrot, Yrot, Zrot, mirror) then begin ?????????Get3DCntr(H1, X, Y, Z);?????????????????????{ Get 3D center } ?????????Set3DRot(H, 0, 0, -Zrot, X, Y, Z);????????{ unrotate it } ?????????Set3DRot(H, 0, -Yrot, 0, X, Y, Z); ?????????Set3DRot(H, -Xrot, 0, 0, X, Y, Z); ?????????HScale3D(H, X, Y, Z, SF, SF, SF);???????{ scale it } ?????????Set3DRot(H,?Xrot, Yrot, Zrot, X, Y, Z);???{ re-rotate it } ??????end;??????{ if } ???End;??????{ ScaleIt3D } Begin ???H1 := FSActLayer; ???While (H1<>Nil) do Begin ??????R1 := Random * 0.4 + 0.6; ??????ScaleIt3D(H1, R1); ??????H1 := NextSObj(H1); ???End; ???RedrawAll; End; Run(RandomScaleSelected);
  17. If you replace HScale3D() with the following procedure, you will be able to scale 3D objects in place, even if they are rotated. Raymond procedure ScaleIt3D(H :Handle; X, Y, Z, SF :Real); { Scale a 3D object by scale factor SF around point (X, Y, Z) } Var mirror :Boolean; Xrot, Yrot, Zrot :Real; Begin if Get3DOrientation(H, Xrot, Yrot, Zrot, mirror) then begin { unrotate it } Set3DRot(H, 0, 0, -Zrot, X, Y, Z); Set3DRot(H, 0, -Yrot, 0, X, Y, Z); Set3DRot(H, -Xrot, 0, 0, X, Y, Z); { scale it } HScale3D(H, X, Y, Z, SF, SF, SF); { re-rotate it } Set3DRot(H,?Xrot, Yrot, Zrot, X, Y, Z); end; { if } End; { ScaleIt3D }
  18. Hi Orlando, In an IF THEN ELSE statement, you cannot have a semi-colon between END and ELSE. A semi-colon there tells the compiler that your IF statement ends after the THEN clause. The ELSE should be kicking an error. Use a semi-colon only after the last END. Use this format: IF ( ) THEN begin end ELSE begin end; I haven't run your script, so I cannot comment further. Happy scripting, Raymond
  19. You can use single characters, but not strings, in a case statement. CH :Char; case CH of ???'a' : begin end; ???'b' : begin end; ???'c' :begin end; ???'d' :begin end; ???'e' :begin end; ???'f' :begin end; ???'g' :begin end; ???'h', 'i', 'j', 'k' :begin end; ???'l' .. 'p' :begin end; ???'q', 'r', 's' :begin end; ???'t', 'u', 'v' :begin end; ???'w' :begin end; ???'x', 'y', 'z' :begin end; end;???{ case } As a rule, case statements only work with enumerated types, that is, variables that have an integer value. HTH, Raymond
  20. From VS Function Reference Appendix Project 2D - 1005 - TRUE of FALSE - ObjectVariableBoolean To turn it on, use: SetObjectVariableBoolean(HandleVP, 1005, True); Raymond
  21. 31? It took me a minute, but I was able visualize 30 from your picture; and the equator makes 31. I love your art, it's a drug for sober people. Thanks, Raymond
  22. This one's an easy one to guess. By trial usage I determined the following: PtOnLine returns TRUE if point Pt is on the line segment defined between points BegPt and EndPt, inclusive; or within a distance, defined by Tolerance, of that line segment. Otherwise it returns FALSE. Pt = point to be tested, stored as a vector (Pt.x, Pt.y, Pt.z) BegPt = first point of line segment, stored as a vector (BegPt.x, BegPt.y, BegPt.z) EndPt = second point of line segment, stored as a vector (EndPt.x, EndPt.y, EndPt.z) Notes: 1) For 2D lines and points, the z component of the three vectors is 0. 2) Because of the nature of real numbers stored in computers, Tolerance should not be set to 0. Make it a suitably small number for your use. 1e-6 or 1e-9 should work for most architectural needs. Anything greater than 1e-323 will work for the number system employed by VW (at least as I've tested it on a Mac).
  23. There is also this function: PtOnLine(Pt, BegPt, EndPt: VECTOR; Tolerance: REAL) : BOOLEAN; Use it in a loop for each side of your Poly. Raymond
  24. Thanks, Ray. I pasted it in again. I appears to be working now. Raymond
  25. To toggle autosave, use this one line script: ???setpref(24, not getpref(24)); To quickly find any constant that is used for a standard preference, go to: VW Preference Constants Raymond
×
×
  • Create New...