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

ConstraintBoundsType

Discussion in 'Alibre Script' started by Matt_AP, Aug 21, 2020.

  1. Matt_AP

    Matt_AP New Member

    I cannot seem to get this parameter to pass in the AddAngleConstraint2 function. It's probably just a python thing (new to this language and not a great programmer at anything) but I've done some searching and have tried lots of different syntax. Specifically I'm trying to use the "Limits" or "Between" type of constraint.

    Thanks for the Help!

    -Matt
     
  2. idslk

    idslk Alibre Super User

    Hallo Matt,

    as far as i have not used it i would guess it should work like this:
    LengthParam = MyPart.AddParameter('Length', ParameterTypes.Distance, 123.4)

    So you should try:
    ...,'MyAngleTest',ConstraintBoundsType.Between)

    Regards
    Stefan
     
  3. Matt_AP

    Matt_AP New Member

    I did try that, here's what I get:

    Traceback (most recent call last):
    File "<string>", line 16, in <module>
    NameError: name 'ConstraintBoundsType' is not defined
     
  4. simonb65

    simonb65 Alibre Super User

    AddAngleConstraint2 and ConstraintBoundsType.Between needs to be used in the context of an assembly, not a part!

    upload_2020-8-21_20-36-11.png

    upload_2020-8-21_20-36-29.png

    @Matt_AP can you post the specific bit of code your're trying to get to work?
     
  5. Matt_AP

    Matt_AP New Member

    Here's the full command I'm using. I'm scripting a chain assembly creator with a for loop. The Align and Mate constraints are working in the loop. Any other ideas to try? Thanks again for the help.

    Asm.AddAngleConstraint2(0, 45, NewParts, NewParts.GetFace("Face<51>"), NewParts[i-1], NewParts[i-1].GetFace("Face<51>"), False, "LinkAngleLimit", ConstraintBoundsType.Between)
     
  6. simonb65

    simonb65 Alibre Super User

    The fact the script parser doesn't recognise the ConstraintBoundsType enum makes me wonder what version of Alibre you're running (might be worth putting it in your signature) as its not complaining about the parameters or indexing of those parameters your passing in, only recognising the enumeration type itself. I'm not sure which version it was in introduced, but someone will be able to confirm that.
     
  7. idslk

    idslk Alibre Super User

    Assembly.ConstraintBoundsType.Between
     
    simonb65 likes this.
  8. Matt_AP

    Matt_AP New Member

    That's it! Thank you!!

    I would not have figured that out.
     
  9. simonb65

    simonb65 Alibre Super User

    I have to say, that I do programming for a living and this is the first time I've really looked at the AlibreScript Documentation and it really needs a graphical Class hierarchy diagram (at the beginning of the help or better still a class hierarchy for each class at the top of each class page) and some simple examples of each function and things like enumerators need to specify the namespace that that belong to!

    How non-programmers understand or even get started with Alibre Script is beyond me!
     
    GIOV likes this.
  10. GIOV

    GIOV Alibre Super User

    I agree..As no Python programmer background, I find this documentation as example that may be inspire to AlibreScript & AlibreGrid and Wizotool.(Discontinued)
    https://www.openscad.org/documentation.html
    GIOV
     

Share This Page