Jump to content

MullinRJ

Member
  • Content Count

    1,304
  • Joined

  • Last visited

Everything posted by MullinRJ

  1. What version of VW? What computer? What OS? You really need to add a signature with these items to get the best answers. TIA, Raymond
  2. Hi Max, As I said, it is a "minimized" script. I must leave something for you to do ;-). Do you have the Script Reference handy? There are similar calls for 3D Symbol queries, and the naming of new symbols is very subjective. If you don't want the script to rewrite an existing one, then you will have to search for the existence of the new name. If you find it you will have to increment or change yours accordingly then check again, but there are many ways to approach this. Be creative. Gotta run now. If you have more questions post again. Heck, @PatStanford hasn't even weighed in on this. If he does you'll get another load of advice to follow. I'll check back later, Raymond
  3. Hi Max, There is no need to duplicate a symbol instance to decompose a copy of it. Just decompose the original instance inside BeginSym() and EndSym, giving it a new name. To avoid problems later, it is best to do all your dirty work at the origin. Move symbol to (0, 0) and unrotate before demo and rebuild. To leave an instance in place, place the new symbol at the same XY/Rot as the original symbol when you are done. Here a minimized script to do just that. PROCEDURE MakeUnique; VAR Selection : HANDLE; X, Y, Rot :Real; BEGIN Selection := FSActLayer; { get handle to Sym } GetSymLoc(Selection, X, Y); { get insertion point } Rot := hAngle(Selection); { get rotation } hMove(Selection, -X, -Y); { movet to origin } hRotate(Selection, 0, 0, -Rot); { unrotate } BeginSym('Sym New'); SymbolToGroup(Selection, 0); if (GetTypeN(LActLayer) = 11) then Ungroup; EndSym; Symbol('Sym New', X, Y, Rot); { place new symbol on drawing } Sysbeep; { make noise when done } END; Run(MakeUnique); HTH, Raymond
  4. Instead of using DoMenuTextByName(), use BeginSym() and EndSym calls before and after your duplication code, respectively. Raymond
  5. Hi Julian, Interesting approach. I knew you'd approach it differently than I. When you said your code might be quicker, it got me thinking. Your code is definitely more concise (quicker to code), but with the create and delete operations the execution speed can be an issue if large numbers of Polys need processing. For small object counts (<1000), both routines execute fast enough to be efficient. However, given enough objects the NURBS routine can appear painfully slow. I measured the two routines processing 1K, 10K, and 100K 3D Polygons. Each poly had 10 vertices. Here's what I got. Poly | JC RM | JC RM Count | Ticks Ticks | Time Time 1K | 57 4 | .95s .07 s 10K | 551 21 | 9.2 s 0.35 s 100K | 5586 175 | 93.1 s 2.92 s Sam, Bottom Line: pick the routine that will work best for your application based on your expected object count. 1-1000 Polys, shorter code looks better and is easier to support. >1000 Polys, summing the vertex distances will be much faster. VectorScript can get data from objects and process numbers and calculations much faster than it can create and delete objects. Just something to keep in mind when designing your coding approach. HTH, Raymond
  6. Hi @Pat Stanford , you guessed it. I initially got hung up using "0". Once I used -1, it got easier. The second and third modes, Collinear and Parallel were much easier to guess how they worked, and with the tech note using symbol wasn't too hard either. Not to make two points of the same object coincident, but the call uses two points on an object to define an edge for Parallel, and Collinear. I'm not sure that's wha you mean, though. Raymond
  7. Hi Sam, After a quick search, I could not find a function that works on 3D Poly, like hPerim() works on 2D Polys. It may be out there, but I could write the routine to sum the legs faster than I could search for a function that does or doesn't exist. But, @Pat Stanford is correct, I've already done that and found one in my script archive. Damn, I wrote it more than a decade ago. I'm getting old. Hey, it's another example using Vectors. DOUBLE BONUS! PROCEDURE Get3DPolyLen_Example; { 20 Dec 2008 - Raymond J Mullin } function Get3DPolyLen(H :Handle) :Real; { Return the perimiter length of 3DPoly H. If H is not a 3DPoly, return 0. } Var I, N :Integer; L :Real; P0, Pa, Pb :Vector; Begin L := 0; if (GetType(H) = 25) then begin N := GetVertNum(H); GetPolyPt3D(H, 0, P0.x, P0.y, P0.z); { 1st vertex } Pa := P0; { copy of 1st vertex } for I := 1 to N-1 do begin GetPolyPt3D(H, I, Pb.x, Pb.y, Pb.z); { vertices 2 through N } L := L + Norm(Pb-Pa); { NORM is the vector DISTANCE function } Pa := Pb; end; { for } if IsPolyClosed(H) then L := L + Norm(P0-Pb); { distance from last to first points } end; { if GetType } Get3DPolyLen := L; End; { Get3DPolyLen } BEGIN AlrtDialog(concat('3D Poly Length = ', Num2StrF(Get3DPolyLen(FSActLayer)))); END; Run(Get3DPolyLen_Example); HTH, Raymond PS - if a native function exists, my bet is @Julian Carr or @JBenghiat would know.
  8. @boro, It took a bit of trial and error for me to figure out how the SetBinaryConsrtaint() function works, but I finally got it. It is NOT intuitive! Here is a very simple example showing how to join the endpoints of two lines together. PROCEDURE SBC_1_Example; { Constrain two lines to share a common point. } { In this example, Pt1 of Line 1 (obj1VertA = 1) is to be coincident to Pt2 of Line 2 (obj2VertA = 2). } { Line 1 will move so its StartPoint is coincident with Line 2's EndPoint. Line 2 will not move. } { The angles of both lines will remain unchanged. } { } { Select two lines and run the script. Line 1 is the first selected object and Line 2 is the second. } { For option 1 (Coincident Points), the second vertex of each object is not needed, so -1 is passed to } { the "obj1VertB" and "obj2VertB" parameters, while 0 is passed to both "containedObj" parameters. } { } { At the end of the script, the Message Window shows the function's result (T/F) amd the numeric type } { of each selected object (LineType = 2).} { 27 Apr 2019 - Raymond J Mullin } VAR H1, H2 :HANDLE; result :BOOLEAN; BEGIN H1 := FSActLayer; { Line 1 handle } H2 := NextSObj(H1); { Line 2 handle } result := SetBinaryConstraint(1, H1, H2, 1, -1, 2, -1, 0, 0); message(result, ' ', GetTypeN(H1), ' ', GetTypeN(H2)); END; RUN(SBC_1_Example); HTH, Raymond
  9. I just tried it with a Polyline connected to two symbols and the Polyline does not scale when one symbol is moved, like the LINE does; so maybe you can't do exactly what you want. Hopefully you can get by by using a LINE. Raymond
  10. Boro, I just tried this for the first time and it seems to work. Use the Constrain Coincident tool to attach one endpoint of a Line to Symbol A and use it again to attach the other end of the Line to Symbol B. Now when you move either Symbol A or Symbol B the endpoints of the Line will move to stay "attached" to each symbol. It works when done manually. I assume it can be scripted. Additionally, if you move the Line, then both symbols will move, too. Good luck, Raymond
  11. Craig, Alternately, you can use the Reshape Tool, 3rd option - Change Vertex Mode, assuming as Pat did that this is a 2D Polygon. 1) Select the polygon, and double click on the Reshape Tool. This opens up the Fillet Settings dialogue box. (You can also click on the last icon on the far right – Reshape Tool Preferences.) Set the radius to the width of your rafter. 2) Select the Change Vertex Mode (1st group), and the Fillet (Circular Arc) Point Mode (2nd group). 3) Click on the vertex to modify. In your example, it's the lower left vertex. (Ignore my units, it's just an example. Use your rafter width instead.) Pat's right, there are other ways, but easier is a judgement call. Pick one you like and keep going. HTH, Raymond
  12. Tom, Do you realize Jim is not gone, he's just not an employee at the moment? Your statement is pretty harsh, and I don't think the rest of the VW employees deserve it, but good luck in your future endeavors. I'm sure you will be missed here, too. Raymond
  13. Yes. This one liner will show the compression used on a placed image: vs.Message(vs.GetObjectVariableLongInt(vs.FSActLayer(), 532)) # 1 = JPEG, 2 = PNG Raymond
  14. First Norte Dame, now YOU! This is a rough April. I hope to see you on the boards soon. Be well. Be happy. Raymond PS - This was not your best Teaser-Tuesday. Just sayin'.
  15. Ryan, I don't think you can do it directly. The best I can suggest is to use a brute force approach. 1) create a new record with the fields of the old record and the one renamed as you like. 2) move default values from the old record to the new. 3) go through the file and attach the new record to any object that has the old record attached. 4) move values from the old attached record to the newly attached record. 5) delete the old record format. This should detach all instances in the file, but if you like, remove the old record after you attach and clone the new one. 6) rename the new record to the old record name with SetName(GetObject('NewRecordName'), 'OldRecordName'). 7) turn this code module into a procedure so you can use it again without a lot of grief. Ideally, if you could get a handle to a record field, you could use SetName() on it, but I don't see that as an option in the VS calls. NOTE: If the record is a PIO record, all bets are off. Also, I have no idea how this will affect any worksheet that references the old record. Since the formulae are text based, it may not matter. As with all complex surgeries, try this on a COPY of your file first! Have fun. If you get it to work let me know. I love it when you get to use a bazooka to swat a fly. 🙂 Raymond
  16. Font Suitcases are pretty old. I would definitely look for a newer version of the font. There seem to be quite a few sites on the web that offer free versions of this typeface. Good Luck, Raymond
  17. Hello Patricia, What kind of font is it; Postscript Type 1, TrueType, OpenType, Scalable Vector Graphics, or (hopefully not) Bitmap? Also, how old is the font file? Perhaps a newer version of the Century Gothic type face would alleviate your problem. Raymond
  18. Christopher, If you ever do figure out how to do this manually, please post back. I'd love to know how it can be done, too. On either platform, you can set these attributes with a script similar to the one I posted earlier that clears them. e.g., DSelectAll; TextFace( [ Shadow, Outline ] ); { sets the Outline and Shadow text styles } It is also possible to cut and paste text between documents that has one or both TextStyle flags set, but that would not affect the application setting, only the object's. However, the EyeDropper tool has a checkbox that "could" transfer those hidden attributes to be part of the text creation default settings. It's a long shot that you would fall into this rabbit hole, but not impossible. Honestly, I think you did it some other way, but I have no idea at the moment how. Again, please post back if you ever figure out how you got there. All the best, Raymond
  19. Since I'm getting a bunch of thumbs-up on this last post, I'm posting a copy of the Vectorworks Enhancement (VE) request I entered yesterday. Please feel free to comment on anything I missed. Anything relevant, I'll add it to my request. Thanks, Raymond ———————————————————————————— VE-99490: Make UI consistent on MAC and WIN for Text objects [Raymond Mullin] Description: With a text object selected, the OIP on Windows does not show checkboxes for the Outline or Shadow style attributes. Outline and Shadow are attributes that can be assigned on the Mac, but not on the PC. A problem exists where a text object can have the Outline or Shadow attributes applied on the Mac and then saved. The same file opened on a Windows version of VW will not indicate in the OIP these attributes are assigned, even though they still are. Searches for Plain Text will not find these objects. The Windows platform will attempt to show outlined text, but the user will be confused how to clear this effect since the OIP is missing these two attributes. Solution, the Outline and Shadow attributes should be added to the OIP on Windows. Even if they always remain gray they would indicate when these attributes are set so users can be informed and act accordingly. I assume the Text>Font Style menu on Windows is also missing these two attributes, but I cannot check now. If so, it too should be updated. ADDITIONALLY, the "Plain Text" attribute that is present in the "TEXT>FONT STYLE" menu should be added to the OIP so users can clear all Font Style attributes with one click, including the inaccessible Outline and Shadow settings on Windows versions. This will benefit Windows users more than Mac users, but it will make the OIP consistent with the TEXT menu and across platforms. Please see this recent thread on the Forum that initiated this VE: (>THIS THREAD<) Graphic of UI elements involved. (Christopher, I hope you don't mind me using your OIP screen shot.)
  20. Thanks @Jim Wilson, One VE coming up (shortly). Raymond
  21. Hi @Jim Wilson, I think Kevin is referring to the Outline and Shadow options that are available on the Mac but not on the PC. They don't show in the OIP of PC. If a user gets a file that was edited on the Mac, these attributes could be set but wouldn't show in the PC's OIP. This adds a lot of confusion files edited on both platforms. I was planning on writing a VE for this this morning. Would you rather have me enter a bug instead? Raymond
  22. @Mason2152, You're welcome. Were you able to fix it with the Text Menu, or did you use the script? Just curious. @Kevin McAllister, Without the "Plain Text" checkbox in the OIP, there is no way to clear all TextStyle settings (like the hidden ones on the PC) in the OIP like you can when you use the TEXT menu above. The OIP and the TEXT menu items should be consistent. You can get there from here, but you have to use multiple UI items to do so. Not good. Raymond
  23. Christopher, The OUTLINE and SHADOW TextStyles are available on the Mac, but not the PC, which is why they don't show in the OIP when you select a text block that has them set. Easy fix - With nothing selected, click on the 'Text > Font Style > Plain Text' menu item. There will be a check mark in front of 'Plain Text' the next time you open the menu. When you see the check mark in front of 'Plain Text', close the file (save if necessary, but not required) and QUIT Vectorworks. This will save this text setting as the default font style when you start a new VW session. If for any reason this doesn't work, then run this short VectorScript and QUIT VW as outlined above. { Set VW TextStyle to PLAIN TEXT (i.e., no formatting). } DSelectAll; TextFace([]); HTH, Raymond
  24. Tui, I just tried your function in VW 2017 and both versions (with descend=TRUE and descend=FALSE) convert the contents of the group to the new class. vs.SetClass(), when used with a GROUP handle always changes the container and all its contents to the new class name. Have you seen it do differently, and if so, where? Thanks, 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...