-
Notifications
You must be signed in to change notification settings - Fork 511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: New Extrude type Skewed #453
Comments
A simpler counter-proposal: what if we added a checkbox to allow any existing extrusion to be skewed? |
@whitequark Where would the flag be stored then? I've also just thought maybe those constraints are applied at the time the group is created? That might be a problem. Come to think of it, when are free parameters created? I've got some other stuff in the works that will require some more options and free parameters (up to 3 fp values). It may not be able to work with existing extrusions due to that. Or maybe those parameters would be typed in. What existing member variables are available for group options? |
We can just add a new one if an existing one doesn't fit. |
I'd like to add two parameters to extrude that will be adjustable on-diagram or have constraints applied. For those I need to add parameters along with the existing ones in Group::Generate here:
So I'd be adding 3 and 4 which is easy but I have questions. Don't other parameters get added after this? When is Generate called? My new options would only need these additional parameters if the user enables them in the text window. I'm thinking the new parameters should always exist so they are not lost if the user turns the feature on and off. But that would mess up the dof count right? @whitequark and @Evil-Spirit can you clarify if this would be an issue and if so, what to do about it? |
I don't think there are any backwards compatibility concerns here. Consider inline hParam hGroup::param(int i) const
{ hParam r; r.v = 0x80000000 | (v << 16) | (uint32_t)i; return r; } Each parameter generated from a group is tagged with the group, so adding new parameters at the end in any group introduces them into unused space.
This would happen if these parameters would not be constrained, but since they are constrained perpendicular in all existing extrusions (which your code should take care of elsewhere), they will be computed to the one value they can hold on the earliest regeneration. If you did not constrain these parameters, then extra care needs to be taken to not mess up existing files; see
Agreed.
It wouldn't if when the feature is turned off there's an equation that sets the parameter to a fixed value. (Watch out for sketches becoming overconstrained when this happens--this can cause slowdowns.) |
@whitequark Sorry about that, I wasn't clear what I'm up to. I think the skewed idea that I started with here is not good because I want to add some extrude features that are incompatible with it. I want to keep the 3 parameters and 2 constraint and add two more optional parameters. That raised the concerns in my previous comment. |
Can you explain the nature of this addition? |
I've added a field to the textbox for "draft angle" which is expected to be just a few degrees. This is something people use to make molds. That's fine, I stored the angle in valA which is currently unused for extrusions and it's not something you'd really want to drag or set on-diagram. The more complex part will be an option group (check boxes) to add a top feature (none / fillet / chamfer) to the top of the extrusion. This will have a free parameter in the solver for the depth of the chamfer, or the radius of the fillet. Then another option group and parameter for the bottom end of the extrusion. I was originally going to implement a new group type for complex extrusions, but I think your earlier comment made me realize people might want to add these features to existing models. So it seems good to extend the existing extrude group type. All this assumes an extrusion perpendicular to the sketch, so it's incompatible with "skew" but I think much more useful. I was going to make a complete prototype first because it's hard to explain how I envision this working. |
"Draft angle" sounds very good to have. I am a bit worried about adding a "top feature" because this seems like a very ad-hoc solution that will not scale well (but which we'll still have to support forever). |
I'm on the fence about it too, hence the idea to make a usable prototype. The problem is that SS will have a hard time getting fully generalized implementations of these features. Straight extrusions are easy enough to add them to with a few issues. |
Let's see what the prototype looks like. |
Looking for input from @jwesthues I'm not sure how to handle an extrusion with a draft angle AND fillet/chamfer. I'm thinking we should type the draft angle in the text window, but I wanted to be able to drag entities on the diagram to change the size of the other features. I've got a picture showing the points involved in extruding a single point (P1) with these features. P1 is the original point in a sketch. P2 would be the "new" end of a single sided extrusion, moved over due to draft angle. P3 and P4 are then needed for a top feature weather that's a fillet or chamfer. P5 and P6 would be for the bottom feature. A bottom fillet will want to go outward if you're sketching on an existing flat surface. My thought was to put a copy of the sketch elements through P6 and P4 which the user could drag up and down to change the height/radius. One issue is that there is no way to put entities anywhere other than on the straight vertical line without extensive changes. Another issues is that none of the obvious distances between points actually match the chamfer radius in the presence of a draft angle. I'm open to ideas in this area. I can write code to create these sorts of surfaces now - without booleans. The problem is how to specify the parameters in the UI. Here's a shot of a double sided extrusion with two different chamfer depths: Notice that the lines on the top and bottom have not been offset along with the solid geometry. The circles at the ends of the holes are small for example, because they have not been enlarged. The issue with this is that SS internally wants an extruded point to be a simple mapping of the original point, but creating these surfaces requires new points to be computed from several of the original points. This is all assuming a straight extrusion, and is in no way a generalized way to modify any given edge on a model. These are features that would go a long way, but I'm stuck on implementation details. Any thoughts on how this might be implemented from the UI point of view? |
As you say, the present entity definitions don't allow you to create that. Nothing stops you from defining new Commercial CAD tools general have "draft" and "round/chamfer" as separate tools that work on surfaces, not properties of the initial extrusion. I suspect that may be what you really want here, like as separate "draft" and "round/chamfer" groups acting on the existing solid model. That's a huge amount of work to implement completely, but a basic implementation (e.g., supporting only plane faces and linear edges) would be relatively straightforward and quite useful. |
@jwesthues This is where the disconnect between entities and shells gets painful. Someone else suggested that I create a solid model from a selected edge and subtract that from the existing model. That completely avoids the need to associate the edge with shell surfaces, but dealing with the various possibilities at the ends seems complicated - I'll think about it. A new POINT_ type is fine, but to create these shapes it needs to be a function of the base point as well as the next and previous point in the loop - weather that's on the same bezier or the next or previous. The core function I used to create the above surfaces is this: 'Vector GetOffsetPt(Vector &pt, Vector &prev, Vector &next, Vector &norm, double d)
} // Create an extruded surface where each end can be offset by some distance
} I've also factored out a nice function to automatically create trim curves for an extrusion of arbitrary number of segments and 2 end caps. So creating something like an extrusion with these features is now pretty easy. The issue is creating equivalent entities in these locations. I have considered creating non-movable entities directly from the shell but that goes against so much (it would be useful for STEP import too). This just seems so useful I want to make it work, but I don't want it to feel like a hack. Imagine taking extruded text and giving it a draft angle and rounded top just by altering the extrusion a little. I shall continue with some type of demo. |
Very much so. Eventually, SolveSpace needs to create constraint solver entities from the solid model, the same as commercial CAD tools do. That's relatively straightforward, since the geometry is already fixed at that time--you can just use numerical points, no solver parameters required. (That would augment the existing entities created from extrusions etc., not replace them. Constraints on the existing extrusion entities can define the extrusion depth, but constraints on the entities generated from the solid model could not, since you can't compute the solid model until the depth is fixed.) You could implement edge rounding / surface drafting / whatever even before that, though, just limited to solid model edges that a corresponding entity already happens to exist for. That's a little more geometry code than you've already implemented, but not by much. |
@whitequark @Evil-Spirit @jwesthues and anyone who uses SolveSpace. I have pushed changes to my "draft" branch that implements draft angles for extrusions. The default angle is zero and can be changed in the text window for extrusions. I'm looking for feedback on this because the "control cage" of entites around the extrusion is still straight - only the solid created has the angled edges. The intent here is to support creation of molds, not fancy edges so the angle is limited to 20 degrees (which is probably excessive). This only works 100 percent geometrically correctly for the following:
Other shapes can do fairly well in appearance but are not mathematically perfect. I am looking for feedback on this. In particular the odd behavior this creates with the UI. On the code side: There are some really useful functions in this that will make all kinds of extrusions possible. The challenge will be in the UI. There is some broken code for creating chamfers in there but that's not accessible from the UI right now. |
I'm closing this because the original idea for skewed extrusion didnt get any positive feedback, and is inferior to some better ideas. |
I am not sure how this "slipped" by me - I usually read all issues and comments :-) Anyway... Skewed extrusions have been possible since at least version 1.9 (17:09:14 Jan 21 2012) - this is the oldest I have handy. Procedure:
Here is an example: |
Hmm there is a bit about this feature it in the reference manual in the "Extrude" section:
But the way this is written does not make it obvious that one can have more than one workplane in a group and extrude perpendicular to one while the drawing is in another one. |
Ohh that's really neat! |
I suspect that was an unintended feature but sometimes those are the best kind ;-) The extrude code will work with any vector, but the comments and the fallback to the loop normal suggests it's supposed to be perpendicular to the sketch normal, but that's rather arbitrary as my suggestion to unconstrain it implied. It's better not to have it constrained at all so you can manipulate the skew in the resulting group. Frustum give you that AND the ability to change the size to make pyramids. |
Maybe.
Please give me a URL to the code, I'm rather unfamiliar with this part of it. What is a "loop normal"? (I should read this whole issue carefully :-)
You can manipulate the skew of the resulting group ;-) Just move the extrusion controlling "workplane". It is not very intuitive but it works.
Sure. But then why not "extrude along a bezier path with a second beezier path controlling the scale and twist"? |
We could call this "Extrude Along Two Paths™" ;-) |
I can not find such a feature in professional CAD (have not actually used any of them since AutoCAD 12 under DOS). |
Ahhh "Maya" cand do it, but I think it is mesh based only? "Catia" can do it - it seems I "invented" a sub-set of loft :-D Sorry for the noise. Once you learn the keywords it is easy :-)
|
@ruevs my intent is to do most of that stuff. For 3D construction I aim for:: Mirror, Frustum, and Extrude along a path. The path concept (in my head) is looking better all the time. Then I hope to add some "features" to standard extrusions: Draft angles, fillets (on top/bottom), and chamfers (top/bottom). Since all of these have had time to bake in my head and a few prototypes have been tried, I can see how certain pieces of code can be shared among them. It's just a problem of having time and doing yet another test or two or three. The path tool might be superior to the ones you linked to above, although I do not intend to allow distortion of the basic shape along the path I might go for changing size and maybe rotation - the UI to get all those working nicely may be a challenge but I've got some really neat ideas in mind. I need to stop hinting at this stuff and get going on it, but it's such a huge project. |
@WooterTheTroubleshooter the technique for making a skewed extrusion is a bit obscure but has been mentioned before. What I want to know is how you appear to be manipulating the workplane used to skew the extrusion after the fact. I am not aware of any way to move such workplanes. Edit: Got it. On Linux it's shift-left-click-drag. You draw the normal (at the origin in this case) that was created for the workplane. The downside is that you can't constrain the angle of the skew in the later group. I hope to add a "frustum" extrusion that will allow the skew as well as scaling the "new" end. Both could be constained in the new group. Another option would be to make optional the 2 perpendicular constraints that are added to an extrude group - they keep the direction of the extrusion aligned to the normal of the workplane. I prefer the frustum idea. |
@phkahler It was not that obvious for me, so I thought it would help other people wanting to do something like this.
I use Shift + W, (based on a point and 2 lines) Currently I use it to constrain the skew based on the height of the base model. (So I like the angle to propagate up instead of down) You can use the existing angle constraints to constrain the workplane to a fixed angle and keep the width the same. Edit: I think being able to mirror would allow to achieve the frustrum effect. Edit: Forgot to mention. + Clarify not using shift-left-click-drag to manipulate the normal of the workplane, but actually using constraints from the model. |
@WooterTheTroubleshooter ok. Your step by step didnt indicate the workplane was defined using other sketch entities. That explains it. |
In the text window for extrusions there are two options: one-sided and two-sided. I propose adding a 3rd option "skewed". This would create a one-sided extrusion but the path of the extrusion would not have to be perpendicular to the sketch plane. I'm not sure how useful this would be so maybe we should discuss it.
My 2 cents, this adds some ability to create different geometry but may not actually be that useful. I'd hate to see it abused to make things that are already hard to make in SolveSpace.
Implementation:
Low complexity - this is a good item for someone new to the SolveSpace code.
Tasks:
The image here shows independent constraints that would normally be fixed to 90 degrees. This can be hacked in code by commenting out 2 lines that apply those 2 constraints.
The text was updated successfully, but these errors were encountered: