I am looking into using python scripts in Adams instead of the command language.
So far I have found 2 examples scripts in the 'adamspy' folder and the help function also provides some examples and classes definitions. However, i feel like i am missing examples to problem solve things i encounter. Does anyone know where i could find more examples?
As an problem example; i got this simple script that creates 2 markers, and should parametrize one marker to the other marker. However, the location of the marker isn't updated. Do i need to call an mod.update() or something?
I just tried your code and it worked as expected for me. I suspect that you expect to see the marker moved by quite a large amount, but perhaps your units are small (millimetre?) so it doesn't look like the marker actually moved. I put in a larger number for the offset {100, 100, 0} and I can clearly see:
the parameterized marker is offset from the referenced marker,
the expression is proper (as you have shown in your image, which makes me think that your model is correct?)
I can move the reference marker and the slave marker moves properly.
So I think that your code is correct. I do recall in a certain version of the code that you could run into an issue with the graphics not updating properly, so *perhaps* that is happening here, but I wonder if the 'delta' that you have used is simply too small to notice when you look at the model quickly?
This looks like a View refresh bug to me, which we will report ASAP. My quick workaround is to use Adams.execute_cmd() instead of Adams.expression() and use the actual marker modify command to ensure that the marker does get placed where it should. Please check out the last line below:
In my Adams version '2020 FP1', the marker does not move, because when i press apply the marker is actually moving to the correct position. So this is most likely a view refresh bug as you guys mentioned. Thanks for the quick workaround!
Just noticed that when i toggle icon visibility the marker actually shows up on the correct position but the name doesn't, hope this helps in solving the bug.
You can simply workaround this by creating a dummy model (in addition to your original model) and delete it immediately. You can add this to end of your code and markers will get refreshed.