cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

iterate sketch and its relations

JZ_4696753
4-Participant

iterate sketch and its relations

Hello, I have a sketch that contains some reference dimensions, for this particular sketch, in the sketch relations that are then used to drive a sketch dimension in the same sketch.  This represents a circular reference which can be resolved through iteration.  When I regenerate multiple times (less than 10 is usually sufficient), the sketch geometry is resolved.  So my question is, is there a way to program in the extra regenerations, or is there another way to program the iterations to resolve the sketch?

1 ACCEPTED SOLUTION

Accepted Solutions
JZ_4696753
4-Participant
(To:tbraxton)

I think we have converged on understanding the problem.  What you helped me understand is all the dimensions must be fully evaluated prior to using the sketch for the revolve feature, which makes complete sense now.  The core problem that remains is how to evaluate sd23 and sd27?  In truth, I was fully expecting to be able to use the power of CAD to be able to resolve the two reference dimensions with a fully-constrained sketch.  Although this looks to have gone as far as it can, I thought of a workaround.  Instead of using relations to solve for my geometry, I created an upstream datum curve using an equation that relates the flow channel section thickness to the radial distance from the rotation axis to the center of the section.  With the curve created upstream from my sketch, it can be used to graphically set the section thickness.  This allows the part to regenerate without issue.  Thank you for causing me to think out of the box, which was required for this particular problem.  The updated part file is attached.

View solution in original post

16 REPLIES 16
tbraxton
20-Turquoise
(To:JZ_4696753)

Generally you should avoid circular references. 

 

Without an understanding of the algorithm required it is hard to recommend the best option to deal with this.

 

Review this thread on an iterative geometry problem. The approach may be applicable to your problem as well.

 

https://community.ptc.com/t5/3D-Part-Assembly-Design/How-to-create-multiple-shapes-with-relation-for... 

JZ_4696753
4-Participant
(To:tbraxton)

Thanks for the suggestion.  I looked through and cannot tell if this would help my case.  But I also uploaded an example part if you wanted to see exactly what is happening in my case and what might possibly eliminate the error messages in the console.

pausob
17-Peridot
(To:JZ_4696753)

Maybe you could reformulate your relations to utilise the SOLVE block and thus find the values of the inter-dependent dimensions simultaneously.   See PTC help on:

 

About Simultaneous Equations 

JZ_4696753
4-Participant
(To:pausob)

Does the solve block interact with my sketch as it is solving?  I have attached an example part in another comment to my OP that attempts to explain the scenario.

pausob
17-Peridot
(To:JZ_4696753)

Not sure, never had to use the SOLVE block 😀   But from the help documentation, it sounds like something that would could be used in our case; though I don't actually know what you are trying to do - and I can't find this "example part" you attached.

I can take a look, so maybe repost it here - but if it is made in anything newer than Creo4, then I won't be able to look at it.

JZ_4696753
4-Participant
(To:JZ_4696753)

Maybe my question was too vague.  I have attached a test part in an attempt to convey by example.  In this testpart, some sketch dimensions and relations are driven by a parameter "diameter".  This represents a revolved flow channel, where the inlet is a pipe, and the outlet is an annulus.  What is special about this geometry is there are some sketch features (construction circles that are dimensioned with the aim of achieving a constant area through the flow channel.  But the dimensions, that set the flow channel cross section, are themselves driven by relations that are driven by other sketch dimensions.  This represents a circular reference that is unavoidable.  Although the model looks to resolve correctly, even in real-time when dragging sketch entities, there are errors that show up in the console.  Normally, I would ignore these errors, but this model is being used to drive some Ansys simulations and Workbench does not like a parametric Creo model that throws regeneration errors.

tbraxton
20-Turquoise
(To:JZ_4696753)

I do not see a part uploaded by you in this thread. It sounds like it is an order if operations issue with the dependency of the relations and that can likely be dealt with. Check again on the parts upload, note that I think you have to compress the part into a .zip or equivalent to upload, also let us know what version of Creo you are working in.

JZ_4696753
4-Participant
(To:tbraxton)

Should be attached to this message.  This was done in Creo 4.0.

tbraxton
20-Turquoise
(To:JZ_4696753)

I would suggest not using sketch relations for this model and would avoid it in general as a practice. The one exception to this is features using the trajpar internal parameter (variable section sweep).

 

I have looked at your model. It requires 6 regenerations to fully regenerate and indicates that the sketch relations of the revolve are not satisfied. This is not a good state to leave the model in if you expect to use it parametrically in design studies.

 

It would seem from your sketch that you are making some assumptions mathematically within the sketch about dimensions that could be defined or solved for before the sketch of the revolve feature must regenerate. I am referring to is the arbitrary assignment of values to dimensions within the sketch that are then used in the relations to calculate dependent dimensions that are expressed as a function of other dims within the sketch. The values for sd23, 27, 92, 95, & 107 should be numerical results before the values of sd22, 67, & 117 are calculated.

 

For example you have assigned a value to sd107 and then use that to calculate sd117. Move as many of these "input" dimensions upstream of the revolve feature as you can. Establish which variables can be defined before solving for the dimensions in the resolve feature that must be derived. Try to solve for the value of all sketch dims (sd) on the right side of the = sign in the current sketch relations prior to the creation of the revolve feature. Convert all of these calculations to part and/or feature relations and build them in the order required.

 

Another option is to define the input values and derive the calculated values prior to any geometry creation. This can be done in a Creo notebook (included with Creo license) or in Mathcad. These results can then be used to drive the model parametrically based on the calculated results.

 

Sketch relations in the test part you posted:

 

area=pi*diameter^2/4
sd115 = diameter/2

sd117=sqrt(area/pi+sd107^2)

sd67=(sqrt((pi*sd95^2+area*cos(sd92))/pi)-sd95)/(cos(sd92))

sd22=(sqrt((pi*sd27^2+area*cos(sd23))/pi)-sd27)/(cos(sd23))

 

 

JZ_4696753
4-Participant
(To:tbraxton)

Hi tbraxton,

Thanks for looking at this model.  Here are some comments to yours.

 

"The values for sd23, 27, 92, 95, & 107 should be numerical results before the values of sd22, 67, & 117 are calculated."  Correct.  And the tricky "numerical results" are sd23 and 27, which are required to solve for sd22.  What makes them tricky is they are reference dimensions, which are a result of the sketch geometry itself.

 

"Move as many of these "input" dimensions upstream of the revolve feature as you can."  OK what I did is took all the sketch relations and moved them into the part relations.  It still requires 6 regenerations to complete successfully.  

 

"Another option is to define the input values and derive the calculated values prior to any geometry creation. "  While this may be true, I believe it defeats the power of using CAD.  The reference dimensions I was trying to use would be very complicated to find an analytical formulation.  And this testpart is a very simplistic version of something far more complex but illustrates the core issue that looks to be at hand which is circular references caused by using a reference dimension that depends on the parameter it is being used to solve for in the sketch.  

 

Isn't there a way to simply program in a loop to regenerate multiple times?

tbraxton
20-Turquoise
(To:JZ_4696753)

Creo relations functionality does not have any capability to loop. I applaud your effort to define all of this in the CAD model. 

 

There is a solve function (mentioned by @pausob  above) that would allow you to define dimensions/parameters as a function of a numerical dimension and solve for values. A simple example for the solve function would be a right rectangular solid defined by the height width and depth dimensions on an extruded feature. If you have a target volume for the "box" you can solve for  the two variable dims based on one linear dim plus the volume provided as known values to this problem by writing relations and solving for the two variable values in relations.

 

It may be possible to use one or more solve block(s) with part/feature relations to implement control of your model as intended. I would need to think about it more to determine that. If you can write a system of equations that have unique solutions for each variable, that is an option. If the equation roots are not unique then this is not reliable as it will only find one root. If you must simultaneously solve for multiple variables in the context of relations then the solve function is the only thing I am aware of that may support this.

 

I would suggest writing some pseudo code for the inputs and calculations required and identify a set of simultaneous equations that may work with the solve block. Assume that there is no loop logic functionality when you do this.

 

Do you have the BMX module for Creo? If so, you have some other options to use numerical methods to achieve the same resultant geometry. Using feasibility/optimization functions would also work for this as they support multi variate design studies.

 

tbraxton
20-Turquoise
(To:JZ_4696753)

Moving the relations from the revolved sketch to the part will not fix this as you found out already. You still have the need to simultaneously solve for multiple values which your existing relations do not deal with as desired.

 

This is consistent with what I would expect as the same dependencies have been moved from the sketch to the part relations. My intent was to solve for some of the values in a feature(s) preceding the revolve, it was implicit (but not clear) that some features would need to be added in the context of staying within part mode. I think the analogue to sd23 and sd27  in your existing sketch need to be evaluated prior to the creation of the revolve feature.

JZ_4696753
4-Participant
(To:tbraxton)

I think we have converged on understanding the problem.  What you helped me understand is all the dimensions must be fully evaluated prior to using the sketch for the revolve feature, which makes complete sense now.  The core problem that remains is how to evaluate sd23 and sd27?  In truth, I was fully expecting to be able to use the power of CAD to be able to resolve the two reference dimensions with a fully-constrained sketch.  Although this looks to have gone as far as it can, I thought of a workaround.  Instead of using relations to solve for my geometry, I created an upstream datum curve using an equation that relates the flow channel section thickness to the radial distance from the rotation axis to the center of the section.  With the curve created upstream from my sketch, it can be used to graphically set the section thickness.  This allows the part to regenerate without issue.  Thank you for causing me to think out of the box, which was required for this particular problem.  The updated part file is attached.

tbraxton
20-Turquoise
(To:JZ_4696753)

@JZ_4696753  I just took a look at your new part and it looks to resolve the issue nicely. The use of the parametric curve from equation is clever.  I will warn you though to change the model from relative accuracy to absolute accuracy to avoid issues with the curve from equation as there is a known bug with curve from equation and relative accuracy causing inaccurate curve geometry. The official PTC fix is to use absolute accuracy.

 

You should always use absolute accuracy by default so if your start part is using relative, I would change it.

 

The BMX module would have dealt with the multivariate iterative solve process. If you work these types of problems often, You should investigate that module.

JZ_4696753
4-Participant
(To:tbraxton)

I was not aware of that bug.  Can you send me a link to learn more about details if you have it?

tbraxton
20-Turquoise
(To:JZ_4696753)

Look through this thread:

https://community.ptc.com/t5/3D-Part-Assembly-Design/Creo-drawing-datum-curve-from-equation-inaccura... 

 

There was a support call logged and PTC punted since Creo 7 was coming out and the default accuracy was changed to absolute in Creo 7. They closed the bug report as resolved. It was not resolved in the context of relative accuracy. The official position is use absolute accuracy and you will not have the problem.

 

tbraxton_0-1660692076395.png

 

Announcements