Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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?
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 Member, Onshape Employees Posts: 413
I'm guessing you're working off an existing feature? For
print
to work, you'd need to importstring.fs
at the top of your Feature Studio.0
Answers
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
Ill play around with it and let you know how the process feels.
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.
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.
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.
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.
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.
@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 🔴
I can't even get print to work, i get error "Function print with 1 argument not found"
if (size(endpoints) != 2)
I'm guessing you're working off an existing feature? For
print
to work, you'd need to importstring.fs
at the top of your Feature Studio.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
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
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 🔴
I added an improvement request for the non-uniform stretching of curves: