Skip to content

Commit

Permalink
Fix #5974 radia local cut plane (#5975)
Browse files Browse the repository at this point in the history
* Fix #5974 - adds center to cut point when specified

---------

Co-authored-by: mkeilman <mkeilman@radiasoft.net>
  • Loading branch information
mkeilman and mkeilman authored Jun 16, 2023
1 parent bf7642f commit 1d57383
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
9 changes: 4 additions & 5 deletions sirepo/package_data/static/json/radia-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,7 @@
"objectCut": {
"cutPlane": ["Cut Plane", "FloatArray", [0, 0, 1], "Normal of the cut plane", ["x", "y", "z"]],
"cutPoint": ["Cut Point", "FloatArray", [0, 0, 0], "", ["x", "y", "z"]],
"useObjectCenter": ["Relative to Object Center", "Boolean", "0"],
"type": ["_", "ObjectCutType", "objectCut"]
},
"objectFillet": {
Expand Down Expand Up @@ -1438,13 +1439,11 @@
},
"objectCut": {
"title": "Plane",
"basic": [
"cutPlane",
"cutPoint"
],
"basic": [],
"advanced": [
"cutPlane",
"cutPoint"
"cutPoint",
"useObjectCenter"
]
},
"objectFillet": {
Expand Down
17 changes: 4 additions & 13 deletions sirepo/template/radia_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,6 @@ def _apply_bevel(g_id, **kwargs):
)


def _apply_cut(g_id, **kwargs):
d = PKDict(kwargs)

# args are object id, point in plane, plane normal - returns array of new ids
return radia.ObjCutMag(
g_id,
d.cutPoint,
d.cutPlane,
"Frame->Lab",
)[0]


def _apply_clone(g_id, xform):
xform = PKDict(xform)
# start with 'identity'
Expand All @@ -136,11 +124,14 @@ def _apply_clone(g_id, xform):

def _apply_cut(g_id, **kwargs):
d = PKDict(kwargs)
p = d.cutPoint
if d.get("useObjectCenter", "0") == "1":
p = (numpy.array(p) + numpy.array(d.obj_center)).tolist()

# args are object id, point in plane, plane normal - returns array of new ids
return radia.ObjCutMag(
g_id,
d.cutPoint,
p,
d.cutPlane,
"Frame->Lab",
)[0]
Expand Down

0 comments on commit 1d57383

Please sign in to comment.