Specifying values of Activity Properties using ALH

Moderator: Moderators

Specifying values of Activity Properties using ALH

Postby kfisher@strattechnologies.com » Tue Jun 29, 2021 3:31 pm

Hello,

I am trying to find a way to add a value to an activity property attribute. I want to use activity properties as opposed to value properties of a block because I intend to reuse this behavior under multiple blocks that have the same data input types.

I would like to loop through some data and construct runtime arrays. I could use opaque actions, but it is time restrictive to initialize each array prior to adding values using javascript or built in math.
ALH.addValue or "add structural feature value actions" would be better for this application. But in order to use ALH helper, or an add structural feature value action, I need the context of the activity in order to add a value to the activity property.

I am able to add the value to the block properties, but not the activity properties. Could someone please help me understand the proper way to do this?
Screen caps and model attached.
Thanks

Screenshot 2021-06-29 173758.png

Screenshot 2021-06-29 173819.png

Screenshot 2021-06-29 173843.png
You do not have the required permissions to view the files attached to this post.
kfisher@strattechnologies.com
Forum Newbie
Forum Newbie
 
Posts: 11
Posts Rating:0
Joined: Wed Mar 03, 2021 9:43 am

Re: Specifying values of Activity Properties using ALH

Postby saulius_p » Wed Jun 30, 2021 1:11 am

Hello,

Good to talk to you. Thank you for your question. Please find small sample. You can run activity with or without context. Works in both cases but with context it can access activity and block properties.

Is this what you are looking for?

Kind regards,
Saulius

Capture.PNG
You do not have the required permissions to view the files attached to this post.
Best regards,
Saulius Pavalkis
User avatar
saulius_p
No Magic
No Magic
 
Posts: 335
Posts Rating:13
Joined: Fri Dec 04, 2009 5:37 am
Full name: Saulius Pavalkis

Re: Specifying values of Activity Properties using ALH

Postby kfisher@strattechnologies.com » Wed Jun 30, 2021 7:56 am

Saulius, thank you so much for the response!

The activity is running in context, so I have access to both the block and the activity parameters. The issue is that I can't use ALH.addValue to add values to the activity properties.

I am not sure if that is because I am doing the "ALH.getContext" part wrong, or if it is simply not possible to use ALH helper on activity properties? Se the second part of the opaque action below.

Thanks

Screenshot 2021-06-30 082048.png
You do not have the required permissions to view the files attached to this post.
kfisher@strattechnologies.com
Forum Newbie
Forum Newbie
 
Posts: 11
Posts Rating:0
Joined: Wed Mar 03, 2021 9:43 am

Re: Specifying values of Activity Properties using ALH

Postby saulius_p » Fri Jul 02, 2021 3:20 am

Hello,

There is no ALH.getContext("doALHstuff").
We have only ALH.getContext() that will return the running context ("ALH" block).
That is why ALH.setValue() works only for properties of "ALH" block, but not for "doALHstuff" activity.

PS.
- ALH.setValue() will work for properties of the activity, if the running context is the activity itself (run the "doALHstuff" activity directly).
- This is not a good practice to store properties on the activity (or other behaviors), properties should store on class or block.
If you want properties to be shared, you should use the class/block generalization and store shared properties on the general class/block.

Hope this helps.

Sincerely,
Saulius
Best regards,
Saulius Pavalkis
User avatar
saulius_p
No Magic
No Magic
 
Posts: 335
Posts Rating:13
Joined: Fri Dec 04, 2009 5:37 am
Full name: Saulius Pavalkis


Return to Cameo Simulation Toolkits

Who is online

Users browsing this forum: No registered users and 0 guests