1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Sketch problem

Discussion in 'Alibre Script' started by Cator, Feb 20, 2021 at 4:51 AM.

  1. Cator

    Cator Member

    Hi,
    When I start this script it gives me an inconsistency between the arc and the line ..... someone can explain why?
     

    Attached Files:

  2. simonb65

    simonb65 Alibre Super User

    You probably need to analyse and heal the sketch before extruding. I found this when drawing sketch based items using the API.

    In c# using the API, I do it with this (which slowly increases the healing tolerance until the sketch heals completely) ...
    Code:
    IAnalyzedSketchData analysis_data = null;
    double healingTolerance = 0.001;
    
    // analyze the sketch
    for (int i = 0; i < 16; i++)
    {
        analysis_data = currentsketch.Analyze(true,       // disjoint ends
                                              true,       // open loops
                                              true,       // overlaps
                                              true,       // self intersections
                                              true,       // degenerate figures
                                              true,       // heal sketch
                                              healingTolerance);     // healing tolerance
    
        if (currentsketch.IsClosed == false)
            healingTolerance *= 2.0;
        else
        {
             //OnEvent("Sketch closed with healing tolerance of " + healingTolerance);
             break;
        }
    }
    
    ... you can probably do something similar in AlibreScript!
     
    Last edited: Feb 20, 2021 at 6:26 AM
    NateLiqGrav and Cator like this.
  3. NateLiqGrav

    NateLiqGrav Alibre Super User

    Last edited: Feb 20, 2021 at 9:10 PM
  4. idslk

    idslk Alibre Super User

    Hello colleagues,

    i've run the script, done an analyse sketch and a heal. The "healed" sketch could be used to do an extrude cut. Looking at the sketch shows the following result:
    upload_2021-2-21_8-18-19.png

    hm...
    without further manual intervention like constraining it gives not the wanted result.

    I modified the script to create only the arc and added printing the arc points:
    Code:
    Units.Current=UnitTypes.Millimeters
    
    CaBPaD = CurrentPart()
    
    Sketch4 = CaBPaD.AddSketch("Sketch", CaBPaD.XYPlane)#CaBPaD.GetFace("Face<6>"))
    
    Test = Sketch4.AddArcCenterStartEnd(-22.0, 20.0, -4.0, 7.35, 0.0, 20.0, False)
    
    print Test.CenterPoint,Test.StartPoint,Test.EndPoint
    
    with the following result:
    upload_2021-2-21_8-21-18.png

    hm...
    some kind of unexpected for me, the three points do not match the ordered...
    Any ideas?

    Regards
    Stefan
     

Share This Page