Jump to content

MullinRJ

Member
  • Posts

    1,623
  • Joined

  • Last visited

Reputation

293 Spectacular

6 Followers

Personal Information

  • Occupation
    Circuit Board Designer
  • Location
    United States

Recent Profile Visitors

3,031 profile views
  1. Hello @WhoCanDo, I did not try to replicate your problem, but I suspect it may have something to do with using PickObject to make your selections. Instead, I built an array of HANDLES to store the crop objects and used the handle array of the crop objects to define the VPs. Here's the sample code: procedure Main; var Lyr : string; i, j : integer; Hands :Array [1..500] of Handle; procedure Log_Selected (h : Handle); begin i := i + 1; Hands[i] := h; end; procedure Create_Viewport(hv :Handle); begin if (hv <> Nil) then begin SetSelect (hv); DoMenuTextByName ('Create Viewport', 0); Layer (Lyr); end; end; BEGIN Lyr := GetLName (ActLayer); i := 0; ForEachObject( Log_Selected, Sel & (L=Lyr) ); DSelectAll; For j := 1 to i do Create_Viewport(Hands[j]); END; Run(Main); It works on a really simple drawing with 5 mock view ports. I get 5 VPs when done. HTH, Raymond
  2. @LarryO, I've used the VS Export feature for years and have had no problems, except for things the Export feature does not support, like holes in a Polyline, and pretty much any new feature in the last decade or two. But, by and large, for exporting simple geometry, it's pretty robust. If you care to post examples where you are having problems I'd be happy to look at them and comment. The example you posted above is pretty vanilla and shouldn't cause a problem. Granted, you may find that VS Export adds what appear to be extra commands that define an object's attributes (like Pen and Fill colors), but you can usually remove them if you find them to be unnecessary for your needs. All the best, Raymond
  3. @LarryO, When I run your code, I get a GROUP with a 3DPoly inside, and I tried it in VW 2019 and VW 2022. Same result. Try it again. If you still see the same thing, try it in a blank file, and if that still doesn't work, restart VW and try once again. You should see a GROUP with a 3DPoly inside. You are right. 3DPolys are not potential containers like Polylines which allow holes, they are more akin to Polygons, which don't allow holes. Raymond
  4. Hi SamIWas, You might want to check again after the Lunar Eclipse next Monday. If you see an improvement, you might be onto something ;-) Raymond
  5. Yes, Message() only updates mid-script if the script is interrupted by an interactive call like GetPt(), or a dialog call like AlrtDialog(). So, what's the point, unless you want to see Sam's point? PROCEDURE StupidMessageTricks; VAR I :Integer; BEGIN for I := 1 to 3 do begin message(I); AlrtDialog(concat(I)); end; { for } END; Run(StupidMessageTricks); Raymond
  6. Did you try HMoveForward() and HMoveBackward()? Raymond
  7. I would start with H := FIn3D(ObjHand); and then use variable H to step through the object's components. But if the container object is a PIO, any changes you make to objects inside will be discarded the next time the PIO regenerates. If the container object is a Symbol, then any change you make inside the symbol will show up in every instance of that symbol in the drawing. If you explain more of what you are trying to achieve, I or someone else, can better explain how to proceed. Raymond
  8. @The Hamma, Out of curiosity, how many scripts is too many? Ball park. I assume the limit depends on how many total items are in a workspace, but knowing how many scripts you added would be interesting to know. Also, were your scripts Menu Items, or Palette Scripts? Thanks, Raymond
  9. Sam, in my experience, whenever you pick an upper limit for a data structure, you can count on a user going right past it. Just sayin'. Raymond
  10. @DomC, That's one of the more creative suggestions I've ever heard. 🤣🤣🤣 Raymond
  11. I just modified the third script above so that it only acts on selected text blocks. I changed <T=Text> to <Sel & (T=Text)>. Now the three scripts should be functionally equivalent. A little sleep does wonders to clear the brain. Raymond
  12. I believe @anthonydcobb is looking for a way to loop through a list of selected text objects to increase or decrease their sizes. In Pascal you can use a for, while, or repeat/until loop, or you can use one of the built-in functions in the ForEachObject function family (there are 5). Here are three examples that essentially do the same thing: This one uses a while loop. PROCEDURE xxx; { Increase the text size of all selected text objects on the active layer by 1 point. } { Assumes all characters in a text block have uniform size. } { Uses a WHILE loop to examine the list of selected objects. } CONST TextSzInc = 1; VAR H :Handle; BEGIN H := FSActLayer; while (H <> nil) do begin if (GetTypeN(H) = 10) then { 10 is object type for TEXT objects. } SetTextSize(H, 0, GetTextLength(H), GetTextSize(H, 0)+TextSzInc); H := NextSObj(H); end; SysBeep; END; Run(xxx); This one uses ForEachObjectInList(). PROCEDURE yyy; { Decrement the text size of all selected text objects on the active layer by 1 point. } { Assumes all characters in a text block have uniform size. } { Uses ForEachObjectInList to control the loop. Only looks at Selected objects, and does not enter Groups. } CONST TextSzInc = -1; function IncPtSz(H :Handle) :Boolean; Begin if (GetTypeN(H) = 10) then SetTextSize(H, 0, GetTextLength(H), GetTextSize(H, 0)+TextSzInc); End; { IncPtSz } BEGIN ForEachObjectInList(IncPtSz, 2, 0, FSActLayer); { 2 = Selected objects, 0 = Shallow } SysBeep; END; Run(yyy); And lastly, this one uses ForEachObject(), which is a CRITERIA based call. PROCEDURE zzz; { Increment the text size of all selected text objects on the active layer by 2 points. } { Assumes all characters in a text block have uniform size. } { Uses ForEachObject() to control the loop, which filters objects by <criteria>. } CONST TextSzInc = 2; procedure IncPtSz(H :Handle); Begin SetTextSize(H, 0, GetTextLength(H), GetTextSize(H, 0)+TextSzInc); End; { IncPtSz } BEGIN ForEachObject(IncPtSz, Sel & (T=Text)); { where "Text" = 10 } SysBeep; END; Run(zzz); You can Pythonize these pascal scripts as is and they will work, or you can use more conventional ways of building a python list of selected text handles and iterate over that list. I will let you decide which way to go. Hopefully this will get you started. Raymond
  13. Try using: vs.Move3DObj(vs.LNewObj(), 0, 0, AOD) instead. This moves the symbol by referencing its handle, and vs.LNewObj() returns a handle to the last object created in the drawing – "usually". Raymond PS - After actually reading your code, move the "move symbol" line after you assign variable h2. Then it should look like this: h2 = vs.LNewObj() vs.Move3DObj(h2, 0, 0, AOD) vs.SetObjectVariableInt(h2, 101, 3) #Set symbol scaling to assymetric ...
  14. You can use the GetPt(X, Y) function, then count the vertices in a loop until the XY values match. It's kind of a brute force method but it will get you there. One way to test the points' proximity is to store both points in vector variables, one for the GetPt value in P1, and the other for the vertex values in P2. Then use this line in your loop to decide: IF (Norm(P2-P1) < Tol) THEN {points match} Set the value of Tol to a number significantly smaller than the distance between your vertices, for example: Tol := 1e-6; { or some relevantly small number } The NORM() function returns the length of a vector, in this case, NORM(P2-P1), or NORM(P1-P2), is the distance between the two points, and it's always non-negative. Also, make sure Snap to Points is turned ON when your script runs. HTH, Raymond
×
×
  • Create New...