Jump to content

MullinRJ

Member
  • Posts

    2,012
  • Joined

  • Last visited

Everything posted by MullinRJ

  1. @michaelk, At first I thought you exposed a bug, but after several days of visiting this post and rereading your code snippet for the umpteenth time I think your confusion is self inflicted. If you remove the SetTextWrap(LNewObj, TRUE); line, do you still get unpredictable results? I suspect not, but If so then you may have found a bug, but I have not been able to reproduce it in my very limited testing. In the following, I use "Text Object" to refer to the text on the page (blue selection handles et al.), and I use "Text Block" to mean the characters of text in your text variable S1. The Text Block's length can only be changed by changing the Font Face, Size, Style, etc., so you can treat it like a constant until you change any of the text's attributes. Now back to your code snippet, with the SetTextWrap(LNewObj, TRUE); line in place you are telling VW to force the text block to use Wrapping, even though the length of the text block is unchanged from its default value, and VW responds in kind. Please note that the Text Wrap checkbox in the OIP does not control a real text attribute. It does not save a boolean value with the file and there is no way to set it to be ON by default. What is saved is the WIDTH of the text block. When the calculated text width does not equal the text block width, either because it was changed manually or programmatically, the Wrap Text checkbox gets set. If you CLEAR the Wrap Text checkbox, either manually or programmatically, the text object's width is set to be equal to the calculated width of the text block (which is affected by Font Face, Size, Style, etc.) What you see on the screen when the Text Object's width does NOT equal the Text Block's length should be predictable. What you see on the screen, when the Text Block's length exactly equals Text Object's width, is affected by what the text block contains. 1) If the Text Block ends in a printable character, the block will wrap the last word (assuming the block contains a white space and words) to the next line. 2) If the Text Block ends with a Space or a Tab character, no visible word wrapping occurs. 3) If the Text Block ends with a Carriage Return, the text block already has a second line, so the first line's appearance is governed by 1) and 2) above. If you don't care to digest all of the minutiae I've just blathered above, then play with this test code and make you own observations. PROCEDURE xxx; { Script to show how OIP "Wrap Text" affects word wrapping with different string endings. } { Change constant "kWordWrap" from FALSE to TRUE to see effects of wrapping. } { Document settings are INCHES, Layer Scale = 1, Font = Arial, Point Size = 12.} { 28 Oct 2021 - Raymond J Mullin } CONST Tb = chr(9); CR = chr(13); Sp = chr(32); kWordWrap = FALSE; VAR S, S1, S2, S3 :String; procedure PlaceText(TxtBlk :String; X, Y :Real); Begin MoveTo(X, Y); BeginText; TxtBlk EndText; SetTextWrap(LNewObj, kWordWrap); End; { PlaceText } BEGIN S := concat('Abysmal echo duck lamps'); S1 := concat(S, Sp); S2 := concat(S, Tb); S3 := concat(S, CR); PlaceText(S, 0, 0); PlaceText(S1, 0, -0.5); PlaceText(S2, 0, -1.0); PlaceText(S3, 0, -1.5); SysBeep; END; Run(xxx); HTH, Raymond PS - I tried @Pat Stanford's example and was able to get the string to word wrap when using Tabs instead of Carriage Returns, but not with Spaces. No idea why. If you are trying to predict how raw character data will wrap, I leave it to you to investigate further. If you limit yourself to human readable words, you may have better results.
  2. Hello @Skia_D, When you say you used the "drop-down menu", to which menu are you referring? Because the file contains Point Cloud data, you should be using File > Import > Import Point Cloud... . It's the last entry in the Import menu. If this menu is causing VW to crash it is probably due to an error in the file. The file size, 49 MB, shouldn't be causing the problem, and it appears you have plenty of RAM. If you're still having trouble, send me a PM and I'll try to import the file for you. Raymond
  3. @NytSkab, If I understand the gist of your question, there is no way to use ImportImageFileN() to suppress the dialog in DoMenuTextByName('Convert Copy to Lines', 0). If you were importing images, you would use the function ImportImageFileN() inline, as you would use ImportImageFile(). But you want an option that does not yet exist for converting copies of 3D objects to lines without a dialog. You will have to request that new functionality from VW Engineering. Use the Wishlist - Feature and Content Requests section of this forum to enter your request. The only reason I mentioned ImportImageFileN() was as an example of a function that originally presented a dialog in ImportImageFile() which was introduced in VW 2014, and then someone (a user or an employee, I don't know which) requested the newer function which had the same features as ImportImageFile(), but without the dialog. ImportImageFileN() was implemented the next year (2015). You will have to request the functionality you desire from Engineering, and hope they will release it in the next VW version. In your Wishlist Request I'd also include the reasons you think it is important, like the number of objects you convert each time you run your script, and the number of times you would potentially use the new feature if it existed. Raymond
  4. @michaelk, Your array of handles needs to be an array of handles to the DOOR RECORDs, and not the DOOR INSTANCE handles. With the handles to records you can access the field with the third argument of SortArray(). Plus, everything Josh said. Raymond
  5. @michaelk, Try two scripts. First script: VSave('test'); SetView(#-90d,#0d,#0d,0",0",0"); Second script: VRestore('test'); Unless your eyes are really, really quick (or your computer is really, really slow), you'll never see a view change between the VSave and VRestore in a single three line script. I'm not at all sure what you are trying to do, but often it is recommended NOT to change the view in a plug-in. Good luck. Raymond
  6. @Pat Stanford, I gave up making people look bad for my New Year's Resolution, but January's coming back around in about 10-11 weeks, so I can resume again next year. I'll put you at the top of my list, if you like. 😁 😉 😛
  7. Sorry, I do not have a way to dismiss a dialog as you desire. The only way I've seen this work in the past is to request a new VectorScript function from the MotherShip that has a "No Dialog" feature built in. As an example ImportImageFile() and ImportImageFileN(), where the latter function (issued a year after the former) uses the setting of the last invocation of the dialog, and only pops the dialog once if the dialog was never presented. Raymond
  8. Hi @Pat Stanford, It appears the dialog only shows for 3D objects. 2D objects (screen and layer planes) don't invoke the dialog even in 3D views. 3D objects will invoke the dialog even in Top/Plan. In rereading the earlier posts that little tidbit was missing. Thanks for turning on the room light, though. 🙄 Raymond
  9. What dialog box? What VW version(s)? What object types are you trying to convert? More info, please. I see no dialogs in VW 2019 - VW 2022. Raymond
  10. @NytSkab, Use: DoMenuTextByName('Convert Copy to Lines', 0); Raymond
  11. @michaelk, Why not place your symbol, rotate it in 3D (or set its 3D angles), THEN convert it to a group? If it is a Hybrid Symbol, you will be limited to Z-axis rotations only. If it is a Hybrid Symbol and you want XY-axis rotations, duplicate the symbol definition, remove all 2D parts, then place the new symbol, rotate, and "explode". Delete the duplicate if desired. Raymond
  12. @Joe Pierre, This seems like it should be a simple thing to do, but it is not. Additionally, there are probably multiple ways to script a solution. Here's a short script that may suit your needs. If not, you are free to modify it until it does. PROCEDURE DecIn_FracFtIn; { Toggle between decimal INCHES and fractional Feet-Inches. } { This script should be customized to meet individual needs. } { 26 September 2021 - Ray Mullin. No warranties expressed or implied. } { Excessive use may cause finger cramps. Use responsibly. } { Script BEEPS when decimal Inches are applied. } Procedure ResetDims(H :Handle); Begin ResetObject(H); End; { ResetDims } BEGIN if (GetPrefInt(170) = 1) then begin { if Feet-Inches } SetPrefInt(170, 2); { Units = Inches } SetPref(168, FALSE); { False = Decimal } SetPref(163, TRUE); { Show unit mark } ForEachObject(ResetDims, T=Dimension); { reset all dimension objects } SysBeep; { Beep for INCHES } end else begin { if Inches (or another unit) } SetPrefInt(170, 1); { Units = Feet-Inches } SetPref(168, TRUE); { True = Fractional } SetPref(175, FALSE); { Rounding Style True = Exact as fractions; False = Non-exact as decimal } SetPrefLongInt(172, 2); { Dimension Fractional Precision (0-6); 1=1/2, ..., 6=1/64 } end; END; Run(DecIn_FracFtIn); Interestingly, dimensions will reformat when the units are changed to Feet-Inches, but they must be manually reset when changing to Inches. Go figure. HTH, Raymond
  13. @Poot, In my best imitation of Frank Morgan (Wizard of Oz), "Well, bust my buttons! Why didn't you say that in the first place? That's a horse of a different color!" With a custom routine, 3D Poly lengths can be measured. Here's a new version. Procedure SelectShort3DPolys; { Selects all 2-vertex 3D Polygons in the active layer shorter than a user } { entered length. } {Augsut (sic) 2, 2017} {© 2017, Pat Stanford pat@coviana.com} {Licensed under the GNU Lesser General Public License} {No warranty expressed or implied. Use at your own peril.} {Abandon hope all ye who enter here. There be dragons.} { 22 September 2021 - modified to select 2-vertex 3D Polys instead of Lines. - Raymond Mullin } { 23 September 2021 - modified to measure length of multi-vertex 3D Polys. - Raymond Mullin } { All of Pat's warnings remain in effect. } Const CR = chr(13); { Carriage Return char } Var H1 :Handle; OLength :Real; Function PolyLen3D (H :Handle) :Real; Var I :Integer; L :Real; P0, P1 :Vector; Begin L := 0; GetPolyPt3D(H, 0, P0.x, P0.y, P0.z); for I := 1 to GetVertNum(H)-1 do begin GetPolyPt3D(H, I, P1.x, P1.y, P1.z); L := L + Norm(P1-P0); P0 := P1; end; { for } if IsPolyClosed(H) then begin GetPolyPt3D(H, 0, P1.x, P1.y, P1.z); L := L + Norm(P1-P0); end; { if } PolyLen3D := L; End; { PolyLen3D } Procedure DoIt(H2:Handle); Begin if (PolyLen3D(H2) <= OLength) then SetSelect(H2); End; { DoIt } Begin DSelectAll; OLength := RealDialog(concat('Enter Maximum 3D Poly Length.', CR, 'All 3D Polys on the active layer shorter or equal to this length will be selected'), '1'); if (OLength > 0) then ForEachObject(DoIt, T=Poly3D) else AlrtDialog('Length must be greater than zero'); End; Run(SelectShort3DPolys); HTH, Raymond
  14. Pat seems to be indisposed at the moment. I modified his script to select 3D Polys instead of Lines. I also assumed you meant 3D Polys with two vertices. This script will not select 3D Polys with three or more vertices. That will take more code. Let me know if I assumed correctly. HTH, Raymond
  15. OS 10.15.x is the minimum for VW 2022. I am using a MacMini (late 2012) and it runs well, even with the "under powered" onboard graphics chips (also, I don't do rendering). One caveat - OS 10.15.x does not run 32 bit applications any more, so if you have old software you need to use, consider that before upgrading your OS. Raymond
  16. Josh, Based on your last comment, this may not be related, but another way to get a locus is to delete a SymDef when that Symbol is still in the drawing. You mentioned Locus which I interpret as a 2D Locus. Deleting a SymDef would leave 3D Loci in the drawing. If you are getting a 2D Locus, then this is not the reason why. Raymond
  17. Hi @Pat Stanford , I've used that call in another script and it worked nicely. The following script is not a 2-liner, but it's still a simple approach. With no object selected, the dialog opens with the active class selected. For the case of editing an object's class, you just need to change the active class before opening the dialog, then restore the active class when done. For a more ubiquitous experience, Waldo's help must be enlisted. @The Hamma , This script should do what you want. If not, please write back. PROCEDURE EditClass; { Open the Organization Dialog and select the class of the first selected object, { or select the Active Class, if no object is selected. } { 24 Jun 2021 - Raymond J Mullin. } { THIS SCRIPT WAS ONLY WHIMSICALLY TESTED. NO WARRANTIES ARE EXPRESSED OR IMPLIED. } { Feel free to modify this script 'til your heart's content. } VAR H :Handle; ActiveCl, aClass :String; BEGIN ActiveCl := ActiveClass; { save current Active Class } aClass := ActiveCl; H := FSActLayer; if (H <> nil) then aClass := GetClass(H); { get class of selected object } NameClass(aClass); { set class to edit before dialog opens } DisplayOrganizationDialog(1); { show Classes tab } NameClass(ActiveCl); { restore active class to original state } END; Run(EditClass); Raymond
  18. @Sloader , From the function's description in the Script Reference there are no arguments, so you are not missing anything there. This function emulates the menu command Import Single DXF/DWG... There does not seem to be a command that will open DXF files without system dialogs opening. Raymond
  19. Hi Malcolm, After looking at the text file you posted, I surmised all the values were Z values and the XY values were implied from the position of the numbers in the data array - 500 values per row, and 500 rows. I then cobbled together a quick script that generated a Locus3D() VectorScript command for each of the values. My assumption was that one row of data from the file had one Y-value and 500 X-values. The next row of data had the next Y-value and the same 500 X-values. Two FOR loops generated all of the intermediate values and assembled the Locus3D() statements. When done I had a text file with 250K lines which I imported into a blank VW file. If my assumptions about the X and Y positions are incorrect, then the Locus array may be flipped. Please inspect the file carefully before using the data. VW 2021 is a bit slow these days when importing large VS files, so I typically use VW 2009 to do the import, which is very quick in comparison, and then open the file in VW 2021. With a little more finesse the script could be written to directly create the Loci in VW, but speed issues become significant when large amounts of data are generated. This can always change and I haven't tested it recently, but it has been an issue for me in the recent past, which is why I prefer writing VS text files and importing them into older versions of the software. This approach is still faster than working directly in newer versions of VW. HTH, Raymond
  20. @Malcolm Woodruff , If you want to see what your data looks like in VW, I've attached a VW 2021 file below with the data imported from your file above. Since I don't know the finer details of the LIDAR file format, I made some assumptions, such as the X values increase from left to right, and the Y values increase from top to bottom as you read your file. If I got the directions wrong, the map may be flipped from what is shown. Also, this file is NOT georeferenced, so you may need to do some more editing. As to graphic performance, it actually navigates faster in VW 2009, but most people probably don't have the older versions loaded. It is possible that it will perform better on your machine than mine as I'm running a macMINI from 2012 with onboard graphics chips (which is nothing I should be bragging about.) That said, it works well enough for what I currently need. Your file only contains 250K Loci, so if you plan to view larger data sets, be warned, it only gets slower. HTH, Raymond sz6090_DSM_2M v2021.vwx
  21. @AlHanson , As you've already discovered, plug-in objects execute quite differently from menu commands. To fully appreciate what is going on behind the scene you should trap each PIO event and display it in an Alert Dialog, just like you displayed the events being presented to your Modern Dialog. In your PIO Event loop, place an Alert Dialog at the top of your event loop just after the lines that return the Custom Object Info, the Event Info, and the New Object status as shown here: CR = chr(13) # define Carriage Return character NIL = vs.Handle() # define NIL ... # Beginning of Event Loop (gFlag, gPIOName, ghParm, ghParmRecord, ghWall) = vs.GetCustomObjectInfo() (gTheEvent, gMessage) = vs.vsoGetEventInfo() gNewObj = vs.IsNewCustomObject(gPIOName) vs.AlrtDialog(vs.Concat('Event = ', gTheEvent, CR, 'Message = ', gMessage, CR, 'New Obj = ', gNewObj, CR, 'Object Handle = ', ghParm != NIL)); if (gTheEvent == kObjOnInitXProperties): # kObjOnInitXProperties = 5 elif (gTheEvent == kParametricRecalculate): # kParametricRecalculate = 3 elif (): # etc. - other events # End of Event Loop Also, be aware that the events your PIO will receive are subject to the flags you set with the vs.SetObjPropVS() function, usually in event kObjOnInitXProperties (5). Setting all of the relevant flags is tricky, at best. The best way to get started is to copy existing examples. Trial and error is also your friend. A list of the Plug-in Object Extended Properties descriptions can be found in this SDK file: .../SDK/SDKVW(<VW build number>)/SDKLib/Include/Kernel/MiniCadHookIntf.h HTH, Raymond
  22. @AlHanson , I would have thought someone would have responded before now, but since no one has, here is my follow up. If you've already solved your problem, please read no further. Otherwise, try the following code snippet. To make your example work I had to add "1" to the value returned in the "data" variable. I did not dig deeply into this and I quit messing with it when it finally worked. You may want to examine this further. Remove the "+ 1" to see what happens with your last symbol icon. Also, I added an IF clause in your "item == SetupDialogC" code to accept the first symbol after the popup is populated. If you don't click in the popup, "bSymbol" is never set to True, which makes it kind of hard to accept the first symbol without a lot of extra clicks to change the popup selection then change it back. Word of caution – The vs.BuildResourceList() command and the other three similar calls (vs.BuildResourceList2, vs.BuildResourceListN, and vs.BuildResourceListN2) are quite persnickety. You have to guess a lot to get what you want. Read the function descriptions carefully. This example works because there is only one file in the specified subfolder. Not sure what happens if there are multiple files in the subfolder and you only want to examine one file. I'll leave that to you if it ever becomes relevant. Lastly, take note of my use of GLOBAL variables. Because the Dialog_Handler() code gets executed repeatedly when the dialog is open, any change made on one pass that is needed for future passes has got to be GLOBAL to that routine, otherwise values will be lost before the dialog finishes executing. import vs debugMode = False btnOK = 1 btnCancel = 2 kThumbnailPopup = 101 SetupDialogC = 12255 LibraryFolder = -13 # "Libraries" folder in VW app folder resourceType = 16 # Symbol Definitions symList = 0 iSymbol = -1 bSymbol = False def Dialog_Handler(item, data): global symList, iSymbol, bSymbol if debugMode: text = 'Running Dialog Handler. Values Returned:\r\ritem: ' + str(item) + ' | data: ' + str(data) vs.AlertCritical('DIALOG HANDLER', text) if item == SetupDialogC: subPath = "Objects - Building Equip_Appliances" (symList, numItems) = vs.BuildResourceList(resourceType, LibraryFolder, subPath) if (numItems > 0): # select the first symbol in the popup bSymbol = True iSymbol = 1 for i in range(numItems+1): name = vs.GetNameFromResourceList(symList, i) #if name[:7] == 'zNested': # continue vs.InsertImagePopupResource(dialog, kThumbnailPopup, symList, i) if item == kThumbnailPopup: # Interaction with Pulldown Menu bSymbol = True iSymbol = data + 1 if debugMode: vs.AlertCritical('Clicked something in popup, setting iSymbol to: ', str(iSymbol)) if (item == btnOK) and bSymbol: # OK Button Pressed and symbol has been selected hSymbol = vs.ImportResourceToCurrentFile(symList, iSymbol) vs.Symbol(vs.GetName(hSymbol), (0, 0), 0) if debugMode: vs.AlertCritical('OK BUTTON!', 'iSymbol: ' + str(iSymbol)) # End of Dialog_Handler def CreateSampleDialog(): global dialog dialog = vs.CreateLayout('Add Choice Sample', 1, 'OK', 'Cancel') vs.CreateThumbnailPopup(dialog, kThumbnailPopup) vs.SetFirstLayoutItem(dialog, kThumbnailPopup) vs.RunLayoutDialog(dialog, Dialog_Handler) # End of CreateSampleDialog vs.SetPref(412, True) # PersistentPythonEngine Pref CreateSampleDialog() HTH, Raymond
  23. @AndreaWok , I exported the VW2013 files to DWG, then saved the files in VW 2021 format, so you can view them in newer VW Viewer versions for years to come. MINICAD 2 DWG & VW2021.zip HTH, Raymond
  24. Hi @AlHanson , Ok, easy question first. Your unknown constant is issued when you close the Popup window. const Sint32 kThumbnailPopupClose = -12613; You can find it documented in: "MiniCadCallbacks.X.h", which can be found in the same directory as "MiniCadCallBacks.h". As to your other issues, I'll have to play with it more to understand. Perhaps someone may beat me to it. Gotta run now. More later, if needed. Raymond PS - Are you getting your popup loaded? I do not see any icons, even though the file you mention is in my application folder. Also, what version of VW are you using and on what platform. A Forum signature would help.
×
×
  • Create New...