AddLinPoly example (Python) #56
-
|
Hi all, I am struggling with the polygon point syntax of AddLinPoly for Python interface. For OpenEMS in Matlab syntax, there is an example and that works well. But I don't understand how to create the polygon point variable for AddLinPoly in Python. Could someone help me out with an example? Something simple with 4 points would be fine, just to see how the variable is created and populated with data and passed to the AddLinPoly call. Best regards PS: This is what I tried: pts_x = np.array([])
pts_y = np.array([])
pts_x = r_[pts_x, -100]
pts_y = r_[pts_y, -100]
pts_x = r_[pts_x, 100]
pts_y = r_[pts_y, -100]
pts_x = r_[pts_x, 100]
pts_y = r_[pts_y, 100]
pts_x = r_[pts_x, 100]
pts_y = r_[pts_y, -100]
pts = np.array([pts_x, pts_y])
TopMetal2.AddLinPoly(pts, 'z', 300, 10)
~~~~~~~~~~~ snip ~~~~~~~~~~~~~~
but in CSXCAD this gives error messages and the polygon doesn't show up:
ERROR: In C:\Users\liebig\Downloads\VTK-8.2.0\Filters\Modeling\vtkLinearExtrusionFilter.cxx, line 124
vtkLinearExtrusionFilter (000001DC36ADBC50): No data to extrude!
ERROR: In C:\Users\liebig\Downloads\VTK-8.2.0\Filters\General\vtkTransformPolyDataFilter.cxx, line 85
vtkTransformPolyDataFilter (000001DC36B34240): No input data
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
|
Well this is why openEMS is open source, you can always have a look in how it's implemented. As I did not remember myself, I had to do it too... See here But looking at it it seems you did everything correctly? Maybe just nobody has tried a polygon in python yet? |
Beta Was this translation helpful? Give feedback.
Problem solved, it was a foolish mistake with my coordinates: there was a typo with the sign of one entry, resulting in invalid shape. The call itself was correct. Thanks for guiding me to find my mistake!