Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

featurescript for beams

barry_gibsonbarry_gibson Member Posts: 31 ✭✭
first off all,hello could some one help me under stand, and then show me how to install the beam feature script into my work document, I've copied Neil's beam generator and can create the beam code  but cannot  seem to bring the new beam into my work document hope you can under stand my question thanks barry
Tagged:

Best Answers

  • barry_gibsonbarry_gibson Posts: 31 ✭✭
    Accepted Answer
    well, well ,well Mr Cooke been all day now kicking my self and its beginning to hurt !! you have now earned some beer tokens today thanks. so in laymen terms the updating / new generating  profile needs to have a wall thickness to generate the sequence code for the standard onshape beam profiles. For some one like me that has no or very little cad experience whose   full time job is worlds apart from yourself and the other pro users my admiration goes out to you all, but having said that having only found onshape in December last year I'am leaning all the time just last night and this morning i designed and part draw a welding table maybe not a lot to some people,but small acorns grow big oak trees so id like to thank you all at onshape for the experience !!    Barry

Answers

  • bradley_saulnbradley_sauln Moderator, Onshape Employees, Developers Posts: 328
    You can watch the following video to walk you through the steps: https://www.onshape.com/featurescript?wvideo=am0koltva4
    Engineer | Adventurer | Tinkerer
    Twitter: @bradleysauln


  • barry_gibsonbarry_gibson Member Posts: 31 ✭✭

    HOW DO I GET THE FEATURESCRIPT BEAMS TO RECOGNIZE THE NEW PROFILES THAT I CREAT?

    jerry_harolwjerry_harolw Posts: 4Member ✭
    I made a copy of the Beams script (named it FeatureScript ModifledBeams), Added the profile for 1" X 1" to the profile list, changed the "beamProfileTable" constant to "beamProfileTableMod" in both the beam profile and beam feature tabs.  When I load the ModifledBeams into the document it does not show the 1X1.  If I open the Beams from the Parts Studio it does not have the 1X1 listed.  How do I get the Beam feature side to recognize the modified table?  By the way the 2X4 that was created in the Webinar does not show up either.  As you might have guessed I am not a programmer.  TIA Jerry




    BEST ANSWERS

    • jerry_harolwjerry_harolw Posts: 4Member ✭
      November 2016 Accepted Answer
      I don't seem to have that option. 
      This is the one I am trying to use 
      I started over and made it a private document, no joy.

      Where do I go to tell it to use my copy?
    • jerry_harolwjerry_harolw Posts: 4Member ✭
      November 2016 Accepted Answer
      Should I shift this over to the weldments thread?
    • jerry_harolwjerry_harolw Posts: 4Member ✭
      November 2016 Accepted Answer
      I have no idea what I did but it is now working.  I was messing around with my copy of the Beam document and I started editing the Cross Frame tab, I removed the BE icon and reinstalled it and it listed the new profiles.  It also is working correctly in new documents.  If insanity is doing the same thing over and over and expecting different results, what is doing the same thing over and over and getting different results?  
    • owen_sparksowen_sparks Posts: 341Member PRO
      November 2016 Accepted Answer
      what is doing the same thing over and over and getting different results?  
      Windows?
      Production Engineer 
      HWM-Water Ltd

    ANSWERS

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 3,109
    @barry_gibson if the code is in the same document as your part studio make sure you are using the script in the pull down menu (cube in curly braces) not the one added to your toolbar (that is linked to a different document). If you are in a different document make sure you created a version in your beam document. Your icon in your toolbar will then show an update icon - right click and select update. 
  • barry_gibsonbarry_gibson Member Posts: 31 ✭✭
    Array index 26 out of bounds.
    913:42   
    FeatureScript Beams - Copy 1 / V1copy3 / Beam Feature (getProfile)
    68:25   
    FeatureScript Beams - Copy 1 / V1copy3 / Beam Feature (const Beam)
    52:17   
    onshape/std/feature.fs (defineFeature)
    220:21   
    Part Studio 6 (const buildPrivate)
    223:13   
    Part Studio 6 (const buildPrivate)
    28:17   
    onshape/std/partStudio.fs (definePartStudio)
    17:12   
    Part Studio 6 (build)
    7:12   

    Part Studio 6 (main)
    morning Neil so were i am i going wrong now !!! i am sure this is easier then i think it is ?? but hey o every day is a school day it would be easier to knit fog me thinks what would help or could some one go onto u tube and post a lesson on how to set this beam featurescript up from the very beginning picture speek a 1000 words thanks barry
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 3,109
    edited March 2017
    I did a webinar recording last year, but I made a few of my own errors while doing it live (most notably, not drawing the profile on the TOP plane which may be your root cause). Hope this helps, if not you can share the doc with me and I'll fix it for you.

     (starting at 34:30)

     

  • barry_gibsonbarry_gibson Member Posts: 31 ✭✭
    thanks for the kind offer Neil,but i will keep plugging away over the weekend to see if sort the problems out, the drawing was definitely on the top plane hopefully will be back in touch Monday morning prompt with some answers, well i can live in hope, thanks Barry    

  • barry_gibsonbarry_gibson Member Posts: 31 ✭✭
    Neil  please, how do i share my document with you ? I've shared the document with onshape support but not heard back from them yet ,  or can some one please tell me how to up load it to this support page. thanks barry
  • barry_gibsonbarry_gibson Member Posts: 31 ✭✭
    Accepted Answer
    well, well ,well Mr Cooke been all day now kicking my self and its beginning to hurt !! you have now earned some beer tokens today thanks. so in laymen terms the updating / new generating  profile needs to have a wall thickness to generate the sequence code for the standard onshape beam profiles. For some one like me that has no or very little cad experience whose   full time job is worlds apart from yourself and the other pro users my admiration goes out to you all, but having said that having only found onshape in December last year I'am leaning all the time just last night and this morning i designed and part draw a welding table maybe not a lot to some people,but small acorns grow big oak trees so id like to thank you all at onshape for the experience !!    Barry
  • barry_gibsonbarry_gibson Member Posts: 31 ✭✭
    Well Neil after many hours,many cups of coffee, and to many thinking sticks, Ive got some profiles working has they should do, 2 questions first would it not be possible to include the master sketch that the profile came from, in the beams featurescript, so when i wanted, to make a new size say in a box profile all i had to do is resize the master copy, then copy and paste the generated code into said profile featurescript press commit job done, or is it not has easy as that ?   
    This is my or has been my problem, when i generated a code for the profile i wanted, my "sequence" :was different to yours in the beam generater, mine, is say  30x30 3mm wall box profile "sequence" : "LALALALA-LALALALA", yours for the same profile is
     "sequence" : "LALALALA-ALALALAL and as i found out on many occasions it will not work so were was i going wrong?
    thanks barry
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 3,109
    The sequence needs to be the same for all profiles in a list (though you can override the sequence in each sub-entry (see the 8020 examples)). The reason my inner profile starts with an arc is a mystery, it's just how I must have sketched it and how the FS Profile Generator extracts the entities.

    Yes you can keep the master sketch in a Part Studio with the FS Profile feature after it. When you update the sketch the generated code would update in the Notices panel which you could then copy and paste.
  • barry_gibsonbarry_gibson Member Posts: 31 ✭✭
    Would that be the way forward Neil, to keep a master sketch and update and then copy paste the entities to make a portfolio of beams ready to use.
  • StefanRStefanR Member Posts: 8 PRO
    Hi Neil, 

    When inserting beam features in a drawing, the tangent edges remain visibile when selecting "show hidden edges" and "hide tangent lines", see image below. According to @lougallo this has to do with: "The part of the script that is building the profile is not exactly tangent from the arcs to the lines.  This very small discrepancy is why the inside faces are showing them as hidden lines and not tangent lines"

    Any change that it can be fixed? 
     

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 3,109
    Hi @StefanR - which profile is that? I tried a dozen different ones and couldn't reproduce it.

    The issue with tangency will be caused by the number of significant digits I used for the profiles. I tested this accuracy in 3D when I created them, but not in 2D:



    To "fix" this, every profile would need to be recreated from scratch and there would be no guarantee that existing beam features would not fail using more accurate profiles. The quick fix for this would be to use the new "custom" profile and use your own sketch as a profile - that way you can be sure that the profiles are not approximated.

    Let me know what you find.
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 3,109
    OK, I found one ISO > Square Hollow Sections > 25 x 25 x 2 n - don't know who created that one, but you can see the internal radius is out:



    I don't know who created these ones, so I can't tell if it was the original sketch or my code that is broken.
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 3,109
    @StefanR - I have found the problem. When I wrote this script there was no built-in FS function for rounding a number to a set number of decimal places, so my code introduced rounding errors that manifest themselves in the smaller section profiles. I will fix this, however it will likely take some time, so please use the alternate method as described above. Thank you for your patience (and for finding it).
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 3,109
    @StefanR - fixed - only affected a small handful of ISO Square & Rectangular profiles. I also updated the Beam Profile Generator script to prevent it happening again, although users should use the Custom option for adding new profiles from now on. 

    Please update to "Official V5".

  • owen_sparksowen_sparks Member, Developers Posts: 2,660 PRO
    NeilCooke said:
     I will fix this, however it will likely take some time.
    27 Minutes later...
    NeilCooke said:
      fixed
    Sheesh Neil, how long do you take when things are urgent?  B)

    O.S.

    Business Systems and Configuration Controller
    HWM-Water Ltd
  • emagdalenaC2iemagdalenaC2i Member, Developers Posts: 612 ✭✭✭✭✭
    edited November 2018
    @NeilCooke We now can add some custom properties from a FeatureScript... so we could:

    1) Add some attributes with extra information in the profiles
    2) Let users Add that attributes in the Beam Profile Generator FeatureScript (setAttributes)
    3) Let users use that attibutes information in the Beam FeatureScript (getAttributes) like Length property = Beam Lengths or Part Name = Profile Name + Length 

    I think this kind of attribute information is already used in sheet metal and Hole features ;-)

    Note: If the profile length change after the Beam FeatureScript creates it, the users could run another FeatureScript at the end of the Part Studio to get the length and set the properties Length or Part Name
    Un saludo,

    Eduardo Magdalena                           C2i Change 2 improve                           ☑ ¿Por qué no organizamos una reunión online?   
                                                                 Consulting Partner de Onshape                                      Averigua a quién conocemos en común

    Consulta mis cursos de Onshape en Español:
  • michael3424michael3424 Member Posts: 506 ✭✭✭

    Sheesh Neil, how long do you take when things are urgent?  B)

    O.S.


    He gets those done before the request is made.  It is really impressive to see how responsive Onshape is to customer issues.
  • MBartlett21MBartlett21 Member Posts: 1,831 EDU
    @NeilCooke We now can add some custom properties from a FeatureScript... so we could:

    1) Add some attributes with extra information in the profiles
    2) Let users Add that attributes in the Beam Profile Generator FeatureScript (setAttributes)
    3) Let users use that attibutes information in the Beam FeatureScript (getAttributes) like Length property = Beam Lengths or Part Name = Profile Name + Length 

    I think this kind of attribute information is already used in sheet metal and Hole features ;-)

    Note: If the profile length change after the Beam FeatureScript creates it, the users could run another FeatureScript at the end of the Part Studio to get the length and set the properties Length or Part Name

    [Emphasis mine]
    @emagdalenaC2i
    In my beams feature, this is very much like what I do for the cutlist.

    I allow custom profiles from Part Studios, like Neil's, but mine requires that the profiles have first been passed through my custom profile generator script, which adds properties of the profile, like base origin points, profile name, part number, material and maximum cut length (a warning is generated if a beam is created longer than this).

    When actually creating the beams, my feature sets attributes on the beams that give an initial length, and a set of edges that go lengthwise. It also sets the profile name into a custom property (and the attribute, so that the cutlist feature can pick up on it).

    After all the beams are created and modified, the Cutlist feature can then be run, which populates the length into both the name and a custom property. It also populates a quantity into a different custom property.

    As another use for the attribute, it is used in the Attached beam feature, which uses the profile origins to snap the attached one to the original.
    It is also used for setting an initial offset for the end cap feature in the same document.

    Link: onsha.pe/documents/cfcc264d41817d876589755c/
    MB - I make FeatureScripts: View FeatureScripts
  • emagdalenaC2iemagdalenaC2i Member, Developers Posts: 612 ✭✭✭✭✭
    I use a custom profile generator too. So I can set attributes to:
    1. all the profiles in the same Standard
    2. all the profiles in the same type
    3. a specific profile

    Un saludo,

    Eduardo Magdalena                           C2i Change 2 improve                           ☑ ¿Por qué no organizamos una reunión online?   
                                                                 Consulting Partner de Onshape                                      Averigua a quién conocemos en común

    Consulta mis cursos de Onshape en Español:
  • MBartlett21MBartlett21 Member Posts: 1,831 EDU
    @emagdalenaC2i

    Please see the below picture for an example use of mine. It supports nowhere near the amount of stuff that you have in yours. For example, it has no concept of a standard. However, mine supports the use of 'Profile origins'. These show as points when the user is inserting the beam, allowing the user to quickly snap to that point. This is intended as a replacement for how Neil's currently works with the profile being cut into 9 points automatically


    One thing I've noticed with mine is that the profile name doesn't populate into the feature name properly (see red underline).
    However, it shows correctly in the feature list.
    MB - I make FeatureScripts: View FeatureScripts
  • emagdalenaC2iemagdalenaC2i Member, Developers Posts: 612 ✭✭✭✭✭
    edited June 9
    I used the Profile Standard and Type in this FS to create a complete library of profiles
    Here you can see an example 

    Each Part Studio has all the Profile sizes in a Profile Type 
    And there are a Part Studio in this document for each Profile Type in the Standard.
    The result is this FeatureScript code of each standard with all the types and sizes


    And a profile library with more than 3,000 references

    The largest Profile Standards Feature Studio has 11,355 lines of code. And of course I was not willing to write them one by one
    Un saludo,

    Eduardo Magdalena                           C2i Change 2 improve                           ☑ ¿Por qué no organizamos una reunión online?   
                                                                 Consulting Partner de Onshape                                      Averigua a quién conocemos en común

    Consulta mis cursos de Onshape en Español:
  • MBartlett21MBartlett21 Member Posts: 1,831 EDU
    @emagdalenaC2i

    I didn't realise that your profile generator was creating code (like Neil's one).
    What mine does is set a variable in the part studio, so then, when the profile is used as a custom profile, it can get the variable and get the options out of it. See for example the taper flange beam part studio in the document. (I have also got it to be generated internally, but not from that feature.)
    I alse don't have that much code in my beams feature relating to standard profiles, because I have got each profile to generate when it is used, making it a lot less likely for one profile to be wrong.

    See beamProfileGenerators.fs, beamStainlessProfiles.fs and beamSteelProfiles.fs. beamStainless and beamSteel profiles are mainly a list of selections, without the code for the profiles, which are generated in beamProfileGenerators.fs
    MB - I make FeatureScripts: View FeatureScripts
Sign In or Register to comment.