Jump to content

MullinRJ

Member
  • Content Count

    1,242
  • Joined

  • Last visited

Everything posted by MullinRJ

  1. MullinRJ

    Script Error

    @The Hamma , That would make perfect sense, but RegularPolygon() is one of those procedures that always takes its input as mm, and not document units. So, YES, you have to scale the inputs to be mm before calling RegularPolygon(). Unfortunately, the documentation does not reflect that. Welcome to the quirky world of VS programming. : ) Raymond
  2. MullinRJ

    Learning Vector Work.

    Josue, The script @Pat Stanford showed you does not work when you are editing inside a Viewport's Annotation Space, nor inside any other container objects, i.e., Symbols, Groups, Profile space of 3D objects, etc. This is because of limitations of the FSActLayer function which only returns handles from selected objects on Design Layers and Sheet Layers. Do a search on "Waldo" in the Vectorscript Forum. You will get several hits that will show you a few lines that will return a handle to a selected object inside a container, like the Viewport's Annotation Space. Waldo is the nickname given to this kind of code that gets you a handle when you are not on a Design or Sheet Layer. Reference "Where's Waldo" to see where the name came from. Have fun and good luck, Raymond
  3. MullinRJ

    Get Symbol Instance from object in Symbol Def??

    Pat, Is the toilet symbol only used in the Bathroom symbol, or does it exist in other symbols, or by itself on the drawing? Can you post a sample file? I doubt I could recreate what you've got from your description. Raymond
  4. MullinRJ

    section arrow font

    As it was explained to me recently by Gunther Miller, the PRINT menu command is supported by APPLE, and the EXPORT menu options are support by Vectorworks. Thanks for submitting the BUG. Raymond
  5. MullinRJ

    section arrow font

    Also worth noting is that the problem does not present itself when using the PRINT menu to Print-To-PDF option. Raymond
  6. MullinRJ

    section arrow font

    Thank you for that. Could you attach a screenshot of the OIP? There are a lot of settings for this marker, and that would be a lot easier than listing them all separately. Or better yet, attach a small file that has your offending marker in it for others to examine. This should save a lot of guessing if the answer is not obvious. Raymond
  7. MullinRJ

    section arrow font

    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
  8. MullinRJ

    Duplicate Symbol Script

    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
  9. MullinRJ

    Duplicate Symbol Script

    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
  10. MullinRJ

    Duplicate Symbol Script

    Instead of using DoMenuTextByName(), use BeginSym() and EndSym calls before and after your duplication code, respectively. Raymond
  11. MullinRJ

    3D Polyline length

    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
  12. MullinRJ

    Connect polyline endpoint to object/symbol

    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
  13. MullinRJ

    3D Polyline length

    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.
  14. MullinRJ

    Connect polyline endpoint to object/symbol

    @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
  15. MullinRJ

    Connect polyline endpoint to object/symbol

    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
  16. MullinRJ

    Connect polyline endpoint to object/symbol

    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
  17. MullinRJ

    Draw Negative of Arc?

    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
  18. MullinRJ

    Until Next Time

    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
  19. MullinRJ

    ExportImageFile does nothing

    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
  20. MullinRJ

    Until Next Time

    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'.
  21. MullinRJ

    Renaming a field in an existing record format?

    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
  22. MullinRJ

    Century Gothic Vector issue

    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
  23. MullinRJ

    Century Gothic Vector issue

    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
  24. MullinRJ

    Text is in outline

    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
  25. MullinRJ

    Text is in outline

    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.)

 

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.

×