Jump to content
Mr. Bardo Krebber

Changing a point or parameter value from a feature

Recommended Posts

Hi all,

 

I tried to change the values of points or parameters from a feature.

This obviosly does not work neither for transient nor for persistant features.

Is there any posibility to set a value of an existing point from a feature?

 

Thanks, Bardo

Share this post


Link to post
Share on other sites

Hi Bardo!

 

Short answer: Please don't!

 

Long answer: Yes, it is possible. And for transient I have to revoke my short answer, because for transient use it is OK. The basic way to do that is to pass the object you want to change as an argument to the Feature. You are then (currently) free to do whatever you want to that object inside the Feature. Note, though, that the argument-type has to match the object-type and cannot be a type the argument can be converted to (i.e. to change an FParameter, use FParameter not FDouble; for F3DPoint do not use FVector3, but F3DPoint - it would be fine to use an FPoint argument-type for F3DPoint, too, but then you could only change the FPoint part of the F3DPoint, or would need to use a cast). 

 

For instances of Features (i.e. persistent Features) this is very problematic, though. The problem is that doing it breaks the dependency model that lies within every CAESES model. Features depend on their arguments (i.e. they are clients of the arguments). So whenever an argument changes, the Feature notices that it needs to be updated. Now, when the Feature itself changes such an argument, it actually causes the argument to become dependent of the Feature. This basically causes a recursive dependency model. I hope that it's clear that this is not good (the only reason it does not lead to disaster is because we built a safety net into Features especially for that case). In fact, it is not good on such a level, that the possibility to do something like that in a persistent Feature will be removed in the version that will hopefully be the next major release (for a very long answer, read the "Multithreading" entry of my blog - see link in my signature).

 

tl;dr; you can do it by passing the object as an argument to the Feature, but please refrain from doing so for persistent Features as it will break the dependency model and will be illegal in future versions.

 

Arne

Share this post


Link to post
Share on other sites

Hi Arne,

thanks a lot for the long answer. I assumed the short one already ;-). I am fully aware that this is not the way the depenency in the framework shold be broken. Anyway we are looking for a posability to implement some checks that can be run prior to the optimization without building dependencies.

I have now implemented a feature that does not take the points to be changed as argument but searches them in the scope using their names.

Anyway I am not sure if this will be invalid too but for the version we use now it works.

Thanks again,

Bardo

Share this post


Link to post
Share on other sites

HI Bardo,

There are a couple of transient features that actually do what you asked for and it is OK. E.g. the selection dependent commands that you see at the top of the main window. Select a bsplinesurface and you will get these scale, rotate, translate etc.

 

Maybe a hint why it did not work in you case: you may have used a FPoint instead of F3DPoint as the argument (that is the mistake that I usually run into). And the base class FPoint does not have a setter function for its components ... could be a projectionPoint or whatever , too.

 

I propose not to search for the name but rather use the object type.

 

Cheers

Claus

Share this post


Link to post
Share on other sites

Hi Bardo,

 

Actually your new approach doesn't really improve the situation, to be honest. After all now the dependency between the Feature and the Points are not tracked anymore at all. Also, your approach will also not work anymore in the next version.

 

So, using transient Feature-execution for something like this is the best bet.

 

Arne

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...