compas
compas copied to clipboard
RobotModel SceneObject with Python3 in Rhino8
Rhino Python3 compatibility
What type of change is this?
Robot scene objects were not working in the Python3 version of Rhino8 Python3 does not have access to the System module
- [?] Bug fix in a backwards-compatible manner. Currently untested in Python2.7 version (WIP)
Checklist
- [ ] I added a line to the
CHANGELOG.mdfile in theUnreleasedsection under the most fitting heading (e.g.Added,Changed,Removed). - [ ] I ran all tests on my computer and it's all green (i.e.
invoke test). - [X ] I ran lint on my computer and there are no errors (i.e.
invoke lint). - [ ] I added new functions/classes and made them available on a second-level import, e.g.
compas.datastructures.Mesh. - [ ] I have added tests that prove my fix is effective or that my feature works.
- [ ] I have added necessary documentation (if appropriate)
hi @gidodielemans,
could you introduce the interesting contribution a little?
something that comes to mind is that a conditional code path may seem relevant: the suggested changes might be incompatible with earlier versions?
is PipeCapMode rhino 8 specific?
--
the joy of reading Rhino 8 & python 3 -- so blissful!
hi @jf--- ,
We have noticed that the compas.scene.SceneObject related to the compas_robots.robot.model.RobotModel is not able to be visualized with the Py3 version in Rhino8, the IronPython2 version is able to. Now there are three issues we encountered:
-
The context was not able to discover the appropriate RobotModelObject, this depends on the context the code is ran in. For "Rhino" it should refer to compas_robots.rhino.scene.RobotModelObject, and for "Grasshopper" to compas_robots.ghpython.scene.RobotModelObject. (You can change this context using the "scriptcontext.doc = Rhino.RhinoDoc.ActiveDoc" or "scriptcontext.doc = ghdoc")
-
The second was that we were not able to import the compas_robots.ghpython.scene.RobotModelObject from the package.
-
And lastly, when the two above were resolved, the Python3 implementation does not have access to the System module as it is related to the .NET implementation of IronPython vs. the C implementation of Py3
Now i have to verify registration of the RobotModelObject on a separate machine as maybe this has stuck even though i reverted this part of the code (as it seemingly works without). Though the fix here references step 3.
With regard to your question on PipeCapMode, I do not know if this is a Rhino8 addition, if so, then yes we would need a conditional to check for the Rhino version. My attempt was solely to remove the System dependency.
Hope this helps :)
Hi again @tomvanmele, I merged the latest updates, and ran the tests, formatter and linter. Seems all green. Any update on the potential of this to be merged?
Thanks for the feedback!
done :)
@gidodielemans ah! You should add yourself to the author's list! Maybe send another tiny PR to add you?
@gidodielemans ah! You should add yourself to the author's list! Maybe send another tiny PR to add you?
If you insist, I didn't think I deserved credit for such a tiny change. I'll be sure to send more substantial requests in the future to make it count!