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

JordanCClark's Screw Selector

Discussion in 'Alibre Script' started by NateLiqGrav, Feb 21, 2019.

  1. NateLiqGrav

    NateLiqGrav Alibre Super User

  2. albie0803

    albie0803 Alibre Super User

    Help Please! I downloaded this script and XML file but it won't run unless the XML file is in "C:\Program Files\Alibre Design\Program". I tried to change the line from tree = ET.parse('screw_data.xml') to tree = ET.parse('C:\Users\allan\Alibre Script Library\screw_data.xml') but it threw an illegal character error.
     
  3. NateLiqGrav

    NateLiqGrav Alibre Super User

    Try putting a lowercase r in front of the quoted string. This tells python to use it as a raw string.

    Code:
    tree = ET.parse(r'C:\Users\allan\Alibre Script Library\screw_data.xml') 
     
  4. albie0803

    albie0803 Alibre Super User

    That did it! Thanks
     
  5. albie0803

    albie0803 Alibre Super User

    Just fiddling for the fun of it and I admit I'm floundering in the dark, but:
    In light of this

    self.StandardCb = ComboBox()
    self.StandardCb.Parent = self
    self.StandardCb.Location = Point(30, 30)
    self.StandardCb.DropDownStyle = ComboBoxStyle.DropDownList

    what is the syntax (if it even exists), to create a Label? I've tried below (a wild stab)

    self.StandardLb = Label()
    self.StandardLb.Parent = self
    self.StandardLb.Location = Point(10, 30)
    self.StandardLB.Text = "Standard"

    It doesn't work and I get System.MissingMemberException: 'IForm' object has no attribute 'StandardLB' I can't find any list of what are valid attributes for IForm.

    I was working on the assumption that self.StandardCb = ComboBox() defined the combobox as StandardCb but obviously not.
     
  6. albie0803

    albie0803 Alibre Super User

    Actually never mind, the more I look at this code the more I realise I understand so little of how dealing with xml files is done. I vaguely get the gist of what happens but I doubt that "a few pointers" would be anywhere enough for me to get any sort of real understanding.

    I'll have to leave things like this to the real coders amongst us.
     
  7. ajayre

    ajayre Alibre Super User

    The problem here is that knowledge of three technologies is required - python, windows forms, python interface to windows forms (aka 'ctypes'). That's a lot to learn and the reason why I created a simplified interface to creating a user interface for scripts. I recommend users stick to that and suggest improvements and only resort to this type of user interface if they are trying to do something advanced.

    Albie - you have 'LB' instead of 'Lb'.

    Andy
     
    NateLiqGrav, idslk and oldfox like this.
  8. albie0803

    albie0803 Alibre Super User

    Doh! So I did, {facepalm} I was hoping to be able to use what worked and just clean up the interface a little bit. Instead I will try and use his builds and data and add them into my bolt builder already.
     

Share This Page