MPh-py / MPh

Pythonic scripting interface for Comsol Multiphysics
https://mph.readthedocs.io
MIT License
265 stars 67 forks source link

Cannot access geometry features inside workplane #135

Closed Aluminum13 closed 1 year ago

Aluminum13 commented 1 year ago

Sorry, my English is not good. I can only describe my problem as much as possible.

If I run this in java: model.component("comp1").geom("geom1").feature("wp1").geom().create("ic1", "InterpolationCurve"); there should be a geom under(model/'geometries'/'geometry 1'/'workplane1'), and a ic in it. But I will only have(model/'geometries'/'geometry 1'/'workplane1').children()=[]

john-hen commented 1 year ago

While I cannot reproduce the problem, as I don't have access to the model you're referring to, I can imagine that it doesn't work as expected. Because that's a geometry sequence that is nested inside another geometry sequence. And I never looked into that, tested that, wondered if that might be an issue. It certainly complicates things.

So this might be a bug. It could also be a missing feature. Hard to say. Because ultimately, the "high-level" Python API, which MPh provides, was never intended to reach feature parity with Comsol itself. This is why you have the "Java-like" low-level API to fall back on. Which MPh also provides, via JPype. So you can script it in Python just like you can in Java. But maybe what Node.children() returns for that particular node is wrong. Quite possible.

If anyone wants to look into this, or even contribute code to extend the existing functionality... you are very welcome to do just that.

john-hen commented 1 year ago

Closed as: unclear. Open a new issue as either a bug report or feature request, whatever may apply.