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.

Just to confirm, you can't write featurescripts that are accessible within a sketch, right?

joshtargojoshtargo Member Posts: 269 EDU

It would be really nice to have non-proportional scaling of sketch elements such as curves.

This is an essential tool for proper surfacing (I was a surface modeler for Honda)

Good highlights come from good surfaces, good surfaces come from good curves, and good curves are "related" to each other.

For example, the centerline of the car roof is made first, then the top of the window is made from a flattened version of the roof curve. Since the two curves are directly related, the highlights of the surface they make will be excellent.

> pick curve
> pick baseline
> enter scale factor or pick point on curve and a target point to scale to
> curve scales normal to baseline

I don't think anything like this exists. Nor do I think it is possible to write a featurescript to do this, correct?

Best Answer

  • _anton_anton Member, Onshape Employees Posts: 413
    Answer ✓

    I'm guessing you're working off an existing feature? For print to work, you'd need to import string.fs at the top of your Feature Studio.

Answers

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,215
    edited October 7

    You are right that custom features don't work within sketches, but you don't need them to do what you're suggesting. If you make a standalone curve (whether using our standard features like bridging curve or fit spline or using a custom feature, like here https://forum.onshape.com/discussion/24874/routing-curve-control-point-curve-introduction-of-two-new-features-for-3d-curve-creation/p1), you can then do a non-uniform scale on it using the transform feature, relative to a mate connector you specify. You can also turn a sketch curve into a standalone curve using the "composite curve" feature. Here's an example I put together — it's got two non-uniformly scaled curves, and if you roll forward all the way, a very clean surface based on them (that took a bit more effort to construct than I'd have liked — will look into improving that): https://cad.onshape.com/documents/1451c4a3d27c4a2b85004a4d/w/b2cf4ed4b53efa9d01d060ee/e/121ff042c810328fbcbcd888

    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • joshtargojoshtargo Member Posts: 269 EDU

    Ill play around with it and let you know how the process feels.

  • joshtargojoshtargo Member Posts: 269 EDU
    edited October 7

    There are many times when the scaling baseline needs to be the Chord of the curve (a line between the endpoints), and it would take an inconvenient number of steps to make a mate connector that represents that. Unless there's a way to Realign a Mate Connector to a Vertex, but it doesnt seem to work.

    It would also be helpful if the movement of the CP curve points could be parallel or normal to the Chord between the start and end, rather than absolute XYZ or relative to the previous point.

    EDIT, more notes after playing some more.

    1. I can make chord line using CP or other tools, and then realign the mate connect to have Z along that line, which rotates the coord sys, so technically that works, but it's a lot of clicking to get to that point in the process.
    2. scaling the curve is tricky, as it requires a specific scaling factor. This makes it difficult to play around with the scale factor to find the right number. scrolling the wheel changes the numbers too much, and typing many different values is time consuming. Can you have an adjustment to change the scroll wheel step value?
    3. many times it's not a scale factor that matters, but rather scaling the curve exactly enough to intersect a vertex.
    4. a Transform Hotkey would be very nice.

  • joshtargojoshtargo Member Posts: 269 EDU

    also, things like this are difficult: I want to rotate the highlighted curve so that the endpoint becomes coincident with the other existing curve. This is also needed in Sketch as well, rather than measuring angles and cutting and pasting the number into transform.

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,215

    For the types of things you mention in your 11:08 post (except the transform shortcut key), FeatureScript can provide good shortcuts tailored to your specific workflow — custom features that compute scaling relative to a chord, compute the scaling factor or a rotation, etc.

    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • joshtargojoshtargo Member Posts: 269 EDU

    It's good to know these things can be easily implemented, but I wish I was a better coder. I have made a few simple featurescripts, but they took days of struggle. For people who do not code, the documentation feels like it's missing a lot of the basics, and I don't know where to look to fill in those gaps.

  • S1monS1mon Member Posts: 3,044 PRO

    Ultimately, what Onshape needs is a real 3D sketch mode. The tool that @josh_targo is asking for is, for instance, a few modifier keys and a drag in a tool like Plasticity or Alias. It doesn't require dozens of clicks and a custom feature. In Plasticity, it's a left click/drag on the end point, then the alt key, and then in this case ctrl to get it to snap to the other endpoint.

    This ability would also be nice in the current Onshape sketcher.

  • MichaelPascoeMichaelPascoe Member Posts: 2,012 PRO
    edited October 7

    @josh_targo Were working on filling in those learning gaps:

    CADSharp FeatureScript Video Lessons
    https://forum.onshape.com/discussion/25402/cadsharp-featurescript-course-free-video-lessonssss


    Also, aside from the official Onshape team, we have the worlds best FS devs (@Konst_Sh and @Jacob_Corder) working at CADSharp,
    so feel free to reach out to us if you need someone to make it for you. 😎


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • joshtargojoshtargo Member Posts: 269 EDU

    I can't even get print to work, i get error "Function print with 1 argument not found"

    if (size(endpoints) != 2)

            {
    
                print("error");
    
            }

    so I have no idea what it is trying to store in variables, which are also giving me errors.

  • _anton_anton Member, Onshape Employees Posts: 413
    Answer ✓

    I'm guessing you're working off an existing feature? For print to work, you'd need to import string.fs at the top of your Feature Studio.

  • joshtargojoshtargo Member Posts: 269 EDU
    edited October 7

    I am very slowly getting somwhere.

    Now you can nonPscale a curve from its endpoints. but I want a lot more functionality.

    Ideally, you would be able to scale a curve from its endpoints AND relocate the endpoints of the scaled copy to two new points (usually the endpoints of two rail curves). it should also stretch the curve enough to make the endpoints coincident to their new locations.



    https://cad.onshape.com/documents/ed769408f2ad20d8a85be8d4/w/c904868f5877928f52b7a549/e/f44aa892929e0d490541a708?renderMode=1&uiState=670426b533d4e10d82932eec

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,215

    Just in case you missed the official learning materials, I recommend starting with the tutorials: https://cad.onshape.com/FsDoc/tutorials/create-a-slot-feature.html and then doing the FeatureScript fundamentals course:

    https://learn.onshape.com/courses/featurescript-fundamentals

    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • MichaelPascoeMichaelPascoe Member Posts: 2,012 PRO

    Oops, I assumed he did those.


    Learn more about the Gospel of Christ  ( Here )

    CADSharp  -  We make custom features and integrated Onshape apps!   Learn How to FeatureScript Here 🔴
  • S1monS1mon Member Posts: 3,044 PRO

    I added an improvement request for the non-uniform stretching of curves:

Sign In or Register to comment.