Jump to content

The Hamma

Member
  • Posts

    293
  • Joined

  • Last visited

Posts posted by The Hamma

  1. Have you ever exported an STL and are disappointed that you can see the facets in a curved surface.  That is because the Very High setting only creates 158 segments in a in cylinder per face.  This causes you to see those facets in your print if your cylinder is large.  Using a vectorscript you are able to export at higher resolutions than the menu command.  Below are STL files of the same cylinder. The first one is exported at Very High using the menu command and the second one exported using the "Export STL UI Quality" script with and input of 1500 in the attached file.  Note that the more complicated the model you may have to reduce the resolution of the export as some of the parts may not export.   

    100 = Very High like the menu command

    UI allows the user to enter a value

    Scripts are provide without warranty and user to use at their own risk.  

    The file must be saved before running the script.  The STL file will be created at the same location as the file and will be named with the active layer name. 

     

    image.png.ca0d7c0cf61f6116f03c3fd4f467173c.pngimage.thumb.png.b61830bfa8d7c7c7f8c8d31b6f225b57.png

     

    image.png.211530dc5b2cf8b0ba834175d7d68c88.pngimage.thumb.png.ad1645b3699ac133519d43a6b178cc95.png

     

     

    STL Export Ultra High Resolution.vwx

  2. I figured out that I can increase the number of facets in an STL export using the ExportSTL command. Per the command the percent of tessellation resolution should be a Real number between 0 and 100 but you can increase that number above 100 to increase the tenssellation.  

     

    FUNCTION   ExportSTL ( filePath:DYNARRAY[] of CHAR;  exportBinary:BOOLEAN;  percentTess:REAL;  exportObjectsOptions:INTEGER) :BOOLEAN ;

     

    percentTess = tessellation resolution -- from 0 to 100     0 -- low,     100 --high

     

  3. I wish there was a way to permanently lock in the viewport cache of a viewport.  Many times we have interior elevations that once they are created and edited they will not change and if they do we are aware that we are editing them.   The issue is that it takes a long time to regenerate all of the interor elevation viewports which are not changing. Sometimes the link is broken and we have to recreate it.  It would be great if there were a switch to permanently lock the viewport cache even after a crash so that the viewports have no need to update unless the lock is swiched off. 

     

    • Like 4
  4. I edited it to also select unstyled versions.  I also added Spaces, Comm Devices, and Receptacles

     

    PROCEDURE SelectMatch;
    VAR
    h : HANDLE;
    piotypeis, layernameis, stylenameis : STRING;
    
    PROCEDURE GetStyleName(h :HANDLE);
    BEGIN
    	stylenameis := GetPluginStyle(h);
    	piotypeis := GetObjectVariableString(h, 1166);
    	
    END;
    
    BEGIN
    layernameis := GetLName(ActLayer);
    ForEachObject (GetStyleName,(NOTINDLVP & NOTINREFDLVP & ((L=layernameis) & (SEL=TRUE) & ((PON='Door') | (PON='Window') | (PON='Space') | (PON='Comm Device') | (PON='Receptacle')))));
    SelectObj((((PON=piotypeis) & (PST=stylenameis) & (L=layernameis))));
    END;
    
    Run(SelectMatch);
    

     

  5. PROCEDURE SelectMatch;
    VAR
    h : HANDLE;
    layernameis, stylenameis : STRING;
    
    PROCEDURE GetStyleName(h :HANDLE);
    BEGIN
    	stylenameis := GetPluginStyle(h);
    END;
    
    BEGIN
    layernameis := GetLName(ActLayer);
    ForEachObject (GetStyleName,(((L=layernameis) & (SEL=TRUE) & ((PON='Door') | (PON='Window')))));
    if stylenameis <> '' THEN SelectObj((((V) & (PST=stylenameis))));
    END;
    
    Run(SelectMatch);

     

    To use select one door or window and run script.

  6. I wrote a script to renumber viewports but I get a warning that the number has been used before.  If Drawing coordination is turned off they no warning is displayed.  So I tried to turn it off in the script and turn it back on at the end but it still gives the warning.  Test file attached. 

     

    {Script Name: VP Label (Consecutive)
    
    This script will renumber drawing labels contained within VP annotations in order picked by mouse. 
    
    David Hamer, 2022 revision 11/7/2022}
    
    
    PROCEDURE NumberVPConsecutive;
    
    VAR	
       numberStr : STRING;
       h,h2, anno, h1 : HANDLE;
       pX,pY : REAL;
       doorNumber,dummyVar,vpNumber : INTEGER;
       zoomis:LONGINT;
       DCPref:BOOLEAN;
    
    PROCEDURE SetVPNumber;
    BEGIN
    GetPt(pX,pY);
      	if GetTypeN(h) = 122 THEN BEGIN {if h is a viewport}
    		anno := GetVPGroup(h, 2); {creates group from annotations of selected viewport}
    		h1 := FInGroup(anno); {selects the first object in the anno group}
    		while h1 <> NIL DO BEGIN { steps through every object in the viewport selected by the click}
    			if GetObjectVariableString(h1, 1166) = 'Drawing Label' THEN BEGIN {if veiwport object is a drawing label}
    				SetRField(h1,'Drawing Label2','Drawing',numberStr); {VW 2021 Version sets the drawing label to the current active number in sequence}
    				vpNumber := Str2Num(numberStr); { convert number string to number.}
    				numberStr := Num2Str(0, vpNumber + 1); {subtract number from sequence then convert number to string.}
    				ResetObject(h1);
    			END;
    			h1 := NextObj(h1); {get next object in viewport\}
    		END;
    		ResetObject(h);
    	END;
    END;
    
    BEGIN
    DCPref := GetPref(544);{get status of drawing coordination}
    SetPref(544,FALSE);{turn off drawing coordination}
    ReDrawAll;
    {•••• Ask for starting number ••••}
    numberStr := StrDialog('Enter and INTEGER to start numbering:','1');
    Message('Click in empty space to end numbering');
    SetVPNumber;
      {•••• Repeat process until there is NO object at the clicked location ••••}
      WHILE GetPickObjectInfo(pX,pY,h,h2,dummyVar) DO BEGIN
        SetVPNumber;
      END;
    ClrMessage;
    {ReDrawAll;}
    SetPref(544,DCPref);{set drawing coordination to original state}
    zoomis:=GetZoom;
    SetZoom(101);
    Setzoom(zoomis);
    END;
    
    RUN(NumberVPConsecutive);

     

    vp renumber.vwx

  7. This is how it works:

    import vs;
    
    def DoIt(h1):
    	vs.AlrtDialog( "we're in", h1 )
    
    def PickPointCallback(pt):
    	vs.ForEachObjectAtPoint(DoIt, 0, 0, pt[0], pt[1], 5)
    
    vs.AlrtDialog( "show let you pick a point, and then show a dialog with the object's handle" )
    vs.GetPt( PickPointCallback )

     

    You need to add your function to the (PickPointCallback) definition part of the script to evaluate pt[0] and pt[1]

  8. Thanks, I just came to same conculsion after I got this script to work minus the refreshing issue. 

     

     

    def FlipIt(h):
    	h1= vs.FIn3D(h)
    	if vs.GetTypeN(h1)==24:
    		h2 =vs.FIn3D(h1)
    		if vs.GetTypeN(h2) == 21:
    			if vs.Random() >= .5:
    				vs.Mirror(h2,False, (0,0), (5,0))
    	vs.ResetObject(h1)
    	vs.ResetObject(h)
    			
    vs.ForEachObjectInLayer(FlipIt,2,2,0)
    

     

  9. Trying to filp the source polyline in an extrude but my scipt does not work.

    Any ideas!

     

    def FlipIt(h):
    	if vs.GetTypeN(h) == 21:
    		if vs.Random() >= .5:
    			vs.SetSelect(h) 
    			vs.FlipVer() # doesn't flip the poly,  but if I replace this command with vs.HDuplicate(h) it will duplicate it
    
    			
    def ResetIt(h):
    	vs.ResetObject(h)
    	
    vs.ForEachObjectInLayer(FlipIt,2,2,0)
    vs.ForEachObjectInLayer(ResetIt,2,0,0)
    
    

     

×
×
  • Create New...