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

Accessing lines, arcs, etc in a sketch

Discussion in 'Alibre Script' started by R-man, Jul 24, 2019.

  1. R-man

    R-man Senior Member

    A couple of questions:

    From a script can I list all lines (for example) in a sketch, and get information about them?

    Can I name a line when I add it to a sketch and then refer to it by name to get info?
  2. albie0803

    albie0803 Alibre Super User

    Yes you can. You can do something like this

    MyPart = Part('My Part')
    MySketch = MyPart.AddSketch('SomeName', MyPart.XYPlane)
    p1 = [0, 0]
    p2 = [0, 10]
    p3 = [10, 10]
    p4 = [10, 5]
    line1 = MySketch.AddLine(p1, p2, False)
    line2 = MySketch.AddLine(p2, p3, False)
    line3 = MySketch.AddLine(p3, p4, False)
    MySketch.AddDimension(line1.Start, line1.End)
    MySketch.AddDimension(line2.Start, line2.End)
    MySketch.AddDimension(line3.Start, line3.End)
    result = MySketch.AddConstraint([line1],Sketch.Constraints.Vertical)
    result = MySketch.AddConstraint([line2],Sketch.Constraints.Horizontal)
    result = MySketch.AddConstraint([line3],Sketch.Constraints.Vertical)
  3. R-man

    R-man Senior Member

    That is exactly what I needed to know. Thank you!
  4. R-man

    R-man Senior Member

    How about getting information about lines etc. For example is there something like lineLen = line3.length ?
  5. NateLiqGrav

    NateLiqGrav Alibre Super User

    Yes, AlibreScript has an ability like that. I suggest checking out the quick start, reference/help files, and examples found in the AlibreScript menu.
  6. R-man

    R-man Senior Member

    Thanks Nate - I've never bothered much with the reference because the terminology is alien to me, but after an hour or so of making the effort I'm finding my way around. Good advice!

Share This Page