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 User Community Spotlight

13567

Comments

  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,936 PRO
    @konstantin_shiriazdanov damn dude. You have some of the coolest ideas
  • RyanAveryRyanAvery Member Posts: 93 EDU
    yeah that is crazy. how long did it take to make the FS?
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    RyanAvery said:
    how long did it take to make the FS?
    around 1-1.5 hours a day during a week, including a lot of debugging
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    edited January 2018
    The thread by @brad_phelan about variable depth helix cut inspired me to make some experiment, that resulted to the Variable section sweep FS. It creates a loft by a number of sketch cross sections along some curve varying value of sketch variables via reference control curves. The variables should be of length type, if angular dimentions requared they should be converted when inserting it in dimension by formula like #alpha (mm) -> #alpha/mm*deg. Currently it has not much controls like boolean scope, body type, units convertion and should be treated as "proof of concept"
    https://cad.onshape.com/documents/2d81c59d7fc5df36ecbaecf3/w/a2de18e932e02a4bd51d3af3/e/0b2c3849b5900737fa810e87


  • brad_phelanbrad_phelan Member Posts: 89 ✭✭
    Hi Konstantin,

    This is awsome stuff. I'm just reading through the feature script code and it taught me a couple of things I didn't think were possible. The most amazing trick is to parameterize a sketch with variables and then use feature driven patterns and law curves to drive copies of this. I'm pretty sure many people will find novel uses for this code. 

    Wow!!
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    The most amazing trick is to parameterize a sketch with variables and then use feature driven patterns and law curves to drive copies of this.
    Hi @brad_phelan,
    yes the ability to regenerate features with new parameters is a big thing (i also used this in Parameter pattern and Curve generator FS's), even if we need to define several variables first. From the other hand it greatly affects feature performance (OS servers are in danger now :D )

  • brad_phelanbrad_phelan Member Posts: 89 ✭✭
    I would suggest one addition to make it easier for paths that twist around an axis. Normally we would want to control the depth/width of the cut as a function of the distance along the axis not the length along the sweep. However  you have used the length along the sweep as the independent variable. An option to evaluate the independent variable as a projection onto some (linear) axis would useful. ie:

        i = proj(p(t),axis) - proj(p(0),axis)

       where 

       t is the sweep curve parameter
       i is the generated independent variable used to drive the law curves.
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    edited February 2018
    @brad_phelan
    the problem is that it a "universal tool" not only for the sweeps that may have some referrence axis, possibly there need a separate modification for particular kind of things like feed screws, but actually you can synchronize the feed of screw along the axis and the depth/width on the "sketch" stage of design when defining the laws of variables vs unwrapped helix line
  • brad_phelanbrad_phelan Member Posts: 89 ✭✭
    The assumption that the length along the sweep is the independent variable makes it less universal. A general mechanism to generate a scalar value from the current point would make it more flexible. My first attempt is to suggest a projection of the point onto a selected curve where by default the curve is the same as the sweep curve. In the default case you get the same result as now. If I choose an straight line then I satisfy my requirement to use the helix axis but anything in between should be possible. 

    For example the model you have used in your demo is based on the screw I described. It has a depth law curve but it is hard to visualize how it is related to the actual model. What engineers with a real drawing would normally do is the following



    Where the orange curve is the law curve for depth with it's independent variable being the location of the sweep point along the cylinder axis. This becomes very easy to work with then as you can see how the depth curve relates directly to the model. In fact you could make break points on the depth curve parametric related to vertices or planes in the model.

    Regards ( and again many thanks for the amazing prototype )

    Brad 
  • brad_phelanbrad_phelan Member Posts: 89 ✭✭
    edited February 2018
    @konstantin_shiriazdanov I'm having a bit of trouble with sketch wrapper. It seems to offset the curve by the length of the cylinder. Am I misunderstanding a feature of the script here? I want to use this to test some of your law curve code and make some test modifications.

    https://cad.onshape.com/documents/96a224a87a3a6725d2263efa/w/89a5acc5b21b6677669ea4ee/e/5b59b999cd77951b8e121e98


  • brad_phelanbrad_phelan Member Posts: 89 ✭✭
    I was able to get it to work with fold rather than sketch wrapper. However fold and sketch wrapper are 90 degrees to each other when using the same mate. ie they don't have the same orientation expectations.


  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    @brad_phelan try to rotate the mate connector of sketch coordinate system at 180 deg. it is about sketch plane orientation I think.
    The assumption that the length along the sweep is the independent variable makes it less universal. A general mechanism to generate a scalar value from the current point would make it more flexible. My first attempt is to suggest a projection of the point onto a selected curve where by default the curve is the same as the sweep curve. In the default case you get the same result as now. If I choose an straight line then I satisfy my requirement to use the helix axis but anything in between should be possible.
    I could try to add some kind of control that would adjust the dependency of control variables from path length. To satisfy the requarement to use this FS with paths made by Sketch wrapper it should extract ordinate of the unwrapped sketch and transform it into length parameter array, that is used to generate control parameter array. But in all other cases it will be just a strange abstract dependency.
  • brad_phelanbrad_phelan Member Posts: 89 ✭✭
    I would suggest projecting the 3d point onto the independent axis of the chosen law curve. 
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    @brad_phelan the problem is that you can't project 3d point to a curve, you can define a secting plane by point and normal and find an intersection point of that plane and the curve, but it requares to define one more parameter like secting plane normal, to create a general enough featurescript. In your specific case you don't even need Sketch wrapper, you could possibly modify the transform law such that it wouldn't rely on external curve, but directly trasform profiles to the certain precalculated positions
  • brad_phelanbrad_phelan Member Posts: 89 ✭✭
    It's true. In general you cannot project 3d point to a curve. But the law curves should be limited to sketches (???) and if so then the 3d point of the target curve is projected to the x axis of the sketch and the y value is looked up. I'm currently modifying some of your code to suit my application. Maybe when I have it working it will be more clear and I can fold it back in.
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    Finally i'm going to add 2 options to adjust control dependeces - by distance from 3d point of sweep path to plane or along line and by ordinate of point of sketch curve, defined by length parameter from the sweep path.
  • brad_phelanbrad_phelan Member Posts: 89 ✭✭
    Neat thanks :)
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    hi, @brad_phelan direction control option was added in v3, suits any entity that matches QueryFilterCompound.ALLOW_DIRECTION

  • brad_phelanbrad_phelan Member Posts: 89 ✭✭
    Hi Konstantin. Thanks for that. I'll try it out. In the meantime I took some of your ideas and made a very specific tool for my application domain. However without your input I would not have got this far. Thanks
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    I have made three FeatureScripts, called Fillet/Chamfer Everything, Fillet/Chamfer Part, and Fillet/Chamfer Xtended.
    Here are some screenshots of each feature:
    Fillet/Chamfer Everything:


    Fillet/Chamfer Part:


    and Fillet/Chamfer Xtended:


    A link to version 5.2 is here.

    These features use a function library that I have made, called "FeatureScript qExtract()", of which version 3.0 is accessible here.
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    With my Features in the post above, I have released version 8.0, which removes some input boxes for bodies and improves the UI.

    Here is a link to it:
     https://cad.onshape.com/documents/7793b338094a4f1de2017739/v/6d718fca97dd3de1d7f1ea52
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    A little FS to make "configurations" of geometry with predefined references to a set of user-defined variables - Parameter pattern FS.
    https://cad.onshape.com/documents/d66ea5fec7a939e866ecbd6f/w/25d8c7ecb4fba2c4e6eb34a4/e/bbc5cf0f6b3fc16186444e0d

    You selecting a set of features that fully defines your initial geometry, insert variable names that should be variated by FS and define a list of parameters of the same length for each variable. The feature generates instances with substituted variable values. Sadly you can't reference external geometry inside the sketches, as it always is with feature patterns.

    @konstantin_shiriazdanov

    This does not work with sketch constraints for some reason.
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    @mbartlett21 it should work, but all the external refferences in the sketch should be eliminated. including dimensions orconstrains to extrnal geometry. if you use them you need to project external geometry to the sketch first and apply fixed constrain to it.
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    edited March 2018
    @mbartlett21 it should work, but all the external refferences in the sketch should be eliminated. including dimensions orconstrains to extrnal geometry. if you use them you need to project external geometry to the sketch first and apply fixed constrain to it.
    Ok, I'll try that

    EDIT: It worked!

    I am trying to replicate what was done in solidworks here:
    http://blogs.solidworks.com/tech/2018/01/winter-challenge-create-a-snowflake-using-all-of-the-solidworks-patterns.html

    Here is my document:
    https://cad.onshape.com/documents/4b1efa6bbe0eba0e4d567b91/
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    @mbartlett21 i'm intersted to see how you use it but this short link to your doc doesn't work
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    @konstantin_shiriazdanov
    The link should work now, I forgot to make it public
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    edited March 2018
    @mbartlett21 i think you could also use RectToPolar FS or Flex FS for some snowflakes, obtained from contour defined in rectangular coordinates (though it has nothing to patterns :* )
  • dave_cowdendave_cowden Member, Developers Posts: 475 ✭✭✭
    edited March 2018
    @konstantin_shiriazdanov @mbartlett21 @mahir I'm pulling together ( updating, actually) a curated list of FeatureScripts-- can you help me assemble the ones you'd like included? I haven't updated the list in a while, so i'm sure 100% of these are outdated.  (https://github.com/dcowden/featurescript)

    I'm also contemplating whether i should have an image for each one-- what do you guys think? Lists are usually just lists, but for this particular problem i think images will be nice.

    I'm planning to use good-ol github so that we can easily merge new submissions.

    @konstantin_shiriazdanov you're such a prolific author, if you have a github account i'll happily add you as a collaborator so you can add your features...

Sign In or Register to comment.