Skip to content

Commit

Permalink
Merge pull request #9 from struberg/fix_attachmentSupport
Browse files Browse the repository at this point in the history
fixes: #8 'Support' attribute got renamed
  • Loading branch information
vectronic authored Aug 19, 2024
2 parents ff77fd7 + cd0d2a4 commit 4eac510
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 37 deletions.
20 changes: 10 additions & 10 deletions Legify/Body.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def _render_body_pad_and_fillets(self):
# body pad

body_pad_sketch = self.brick.newObject("Sketcher::SketchObject", "body_pad_sketch")
body_pad_sketch.Support = (self.xy_plane, '')
body_pad_sketch.AttachmentSupport = (self.xy_plane, '')
body_pad_sketch.MapMode = 'ObjectXY'

body_pad_sketch.addGeometry([
Expand Down Expand Up @@ -278,7 +278,7 @@ def _render_body_pocket(self, body_pad_sketch):
# body pocket

body_pocket_sketch = self.brick.newObject("Sketcher::SketchObject", "body_pocket_sketch")
body_pocket_sketch.Support = (body_pad_sketch, '')
body_pocket_sketch.AttachmentSupport = (body_pad_sketch, '')
body_pocket_sketch.MapMode = 'ObjectXY'

side_ribs = self.height > 2 and self.depth > 1 and self.width > 1
Expand Down Expand Up @@ -472,7 +472,7 @@ def _render_tube_ribs(self):
# front tube ribs pad

front_tube_ribs_sketch = self.brick.newObject("Sketcher::SketchObject", "front_tube_ribs_sketch")
front_tube_ribs_sketch.Support = (self.front_inside_datum_plane, '')
front_tube_ribs_sketch.AttachmentSupport = (self.front_inside_datum_plane, '')
front_tube_ribs_sketch.MapMode = 'FlatFace'

# add top_inside_datum_plane to sketch as an edge so that it can be referenced
Expand Down Expand Up @@ -515,7 +515,7 @@ def _render_tube_ribs(self):
# side tube ribs pad

side_tube_ribs_sketch = self.brick.newObject("Sketcher::SketchObject", "side_tube_ribs_sketch")
side_tube_ribs_sketch.Support = (self.left_inside_datum_plane, '')
side_tube_ribs_sketch.AttachmentSupport = (self.left_inside_datum_plane, '')
side_tube_ribs_sketch.MapMode = 'FlatFace'

# add top_inside_datum_plane to sketch as an edge so that it can be referenced
Expand Down Expand Up @@ -558,7 +558,7 @@ def _render_tubes(self, body_pad_sketch):
# tubes pad

tubes_pad_sketch = self.brick.newObject("Sketcher::SketchObject", "tubes_pad_sketch")
tubes_pad_sketch.Support = (body_pad_sketch, '')
tubes_pad_sketch.AttachmentSupport = (body_pad_sketch, '')
tubes_pad_sketch.MapMode = 'ObjectXY'
tubes_pad_sketch.Placement = Placement(Vector(0, 0, DIMS_STICK_AND_TUBE_BOTTOM_INSET),
Rotation(Vector(0, 0, 1), 0))
Expand Down Expand Up @@ -591,7 +591,7 @@ def _render_tubes(self, body_pad_sketch):
# tubes pocket

tubes_pocket_sketch = self.brick.newObject("Sketcher::SketchObject", "tubes_pocket_sketch")
tubes_pocket_sketch.Support = (self.top_inside_datum_plane, '')
tubes_pocket_sketch.AttachmentSupport = (self.top_inside_datum_plane, '')
tubes_pocket_sketch.MapMode = 'FlatFace'

add_inner_circle_with_flats_to_sketch(tubes_pocket_sketch, DIMS_TUBE_OUTER_RADIUS,
Expand Down Expand Up @@ -625,9 +625,9 @@ def _render_stick_ribs(self):

stick_ribs_sketch = self.brick.newObject("Sketcher::SketchObject", "stick_ribs_sketch")
if self.width > 1:
stick_ribs_sketch.Support = (self.front_inside_datum_plane, '')
stick_ribs_sketch.AttachmentSupport = (self.front_inside_datum_plane, '')
else:
stick_ribs_sketch.Support = (self.left_inside_datum_plane, '')
stick_ribs_sketch.AttachmentSupport = (self.left_inside_datum_plane, '')
stick_ribs_sketch.MapMode = 'FlatFace'

# add top_inside_datum_plane to sketch as an edge so that it can be referenced
Expand Down Expand Up @@ -687,7 +687,7 @@ def _render_sticks(self, body_pad_sketch):
# sticks pad

sticks_pad_sketch = self.brick.newObject("Sketcher::SketchObject", "sticks_pad_sketch")
sticks_pad_sketch.Support = (body_pad_sketch, '')
sticks_pad_sketch.AttachmentSupport = (body_pad_sketch, '')
sticks_pad_sketch.MapMode = 'ObjectXY'
sticks_pad_sketch.Placement = Placement(Vector(0, 0, DIMS_STICK_AND_TUBE_BOTTOM_INSET),
Rotation(Vector(0, 0, 1), 0))
Expand Down Expand Up @@ -738,7 +738,7 @@ def _render_sticks(self, body_pad_sketch):
# sticks pocket

sticks_pocket_sketch = self.brick.newObject("Sketcher::SketchObject", "sticks_pocket_sketch")
sticks_pocket_sketch.Support = (self.top_inside_datum_plane, '')
sticks_pocket_sketch.AttachmentSupport = (self.top_inside_datum_plane, '')
sticks_pocket_sketch.MapMode = 'FlatFace'

geometries = []
Expand Down
22 changes: 11 additions & 11 deletions Legify/Brick.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def _create_datum_planes(self, context):
# Create top datum plane
top_datum_plane = context.brick.newObject("PartDesign::Plane", "top_datum_plane")
top_datum_plane.MapReversed = False
top_datum_plane.Support = [(context.brick.Origin.OriginFeatures[ORIGIN_XY_PLANE_INDEX], '')]
top_datum_plane.AttachmentSupport = [(context.brick.Origin.OriginFeatures[ORIGIN_XY_PLANE_INDEX], '')]
top_datum_plane.MapMode = 'FlatFace'
top_datum_plane.AttachmentOffset = Placement(Vector(0, 0, (self.height * DIMS_PLATE_HEIGHT)), Rotation(0, 0, 0))
top_datum_plane.ViewObject.Visibility = False
Expand All @@ -321,7 +321,7 @@ def _create_datum_planes(self, context):
# Create front datum plane
front_datum_plane = context.brick.newObject("PartDesign::Plane", "front_datum_plane")
front_datum_plane.MapReversed = False
front_datum_plane.Support = [(context.brick.Origin.OriginFeatures[ORIGIN_XZ_PLANE_INDEX], '')]
front_datum_plane.AttachmentSupport = [(context.brick.Origin.OriginFeatures[ORIGIN_XZ_PLANE_INDEX], '')]
front_datum_plane.MapMode = 'FlatFace'
front_datum_plane.AttachmentOffset = Placement(
Vector(0, 0, (DIMS_STUD_SPACING / 2) - DIMS_BRICK_OUTER_REDUCTION), Rotation(0, 0, 0))
Expand All @@ -331,7 +331,7 @@ def _create_datum_planes(self, context):
# Create back datum plane
back_datum_plane = context.brick.newObject("PartDesign::Plane", "back_datum_plane")
back_datum_plane.MapReversed = False
back_datum_plane.Support = [(context.brick.Origin.OriginFeatures[ORIGIN_XZ_PLANE_INDEX], '')]
back_datum_plane.AttachmentSupport = [(context.brick.Origin.OriginFeatures[ORIGIN_XZ_PLANE_INDEX], '')]
back_datum_plane.MapMode = 'FlatFace'
back_datum_plane.AttachmentOffset = Placement(
Vector(0, 0, -1 *
Expand All @@ -343,7 +343,7 @@ def _create_datum_planes(self, context):
# Create left datum plane
left_datum_plane = context.brick.newObject("PartDesign::Plane", "left_datum_plane")
left_datum_plane.MapReversed = False
left_datum_plane.Support = [(context.brick.Origin.OriginFeatures[ORIGIN_YZ_PLANE_INDEX], '')]
left_datum_plane.AttachmentSupport = [(context.brick.Origin.OriginFeatures[ORIGIN_YZ_PLANE_INDEX], '')]
left_datum_plane.MapMode = 'FlatFace'
left_datum_plane.AttachmentOffset = Placement(
Vector(0, 0, -1 * ((DIMS_STUD_SPACING / 2) - DIMS_BRICK_OUTER_REDUCTION)),
Expand All @@ -354,7 +354,7 @@ def _create_datum_planes(self, context):
# Create right datum plane
right_datum_plane = context.brick.newObject("PartDesign::Plane", "right_datum_plane")
right_datum_plane.MapReversed = False
right_datum_plane.Support = [(context.brick.Origin.OriginFeatures[ORIGIN_YZ_PLANE_INDEX], '')]
right_datum_plane.AttachmentSupport = [(context.brick.Origin.OriginFeatures[ORIGIN_YZ_PLANE_INDEX], '')]
right_datum_plane.MapMode = 'FlatFace'
right_datum_plane.AttachmentOffset = Placement(
Vector(0, 0,
Expand All @@ -366,7 +366,7 @@ def _create_datum_planes(self, context):
# Create top inside datum plane
top_inside_datum_plane = context.brick.newObject("PartDesign::Plane", "top_inside_datum_plane")
top_inside_datum_plane.MapReversed = False
top_inside_datum_plane.Support = [(context.brick.Origin.OriginFeatures[ORIGIN_XY_PLANE_INDEX], '')]
top_inside_datum_plane.AttachmentSupport = [(context.brick.Origin.OriginFeatures[ORIGIN_XY_PLANE_INDEX], '')]
top_inside_datum_plane.MapMode = 'FlatFace'
top_inside_datum_plane.AttachmentOffset = Placement(
Vector(0, 0, (self.height * DIMS_PLATE_HEIGHT) - DIMS_TOP_THICKNESS), Rotation(0, 0, 0))
Expand All @@ -376,7 +376,7 @@ def _create_datum_planes(self, context):
# Create front inside datum plane
front_inside_datum_plane = context.brick.newObject("PartDesign::Plane", "front_inside_datum_plane")
front_inside_datum_plane.MapReversed = False
front_inside_datum_plane.Support = [(context.brick.Origin.OriginFeatures[ORIGIN_XZ_PLANE_INDEX], '')]
front_inside_datum_plane.AttachmentSupport = [(context.brick.Origin.OriginFeatures[ORIGIN_XZ_PLANE_INDEX], '')]
front_inside_datum_plane.MapMode = 'FlatFace'
front_inside_datum_plane.AttachmentOffset = Placement(
Vector(0, 0, (DIMS_STUD_SPACING / 2) - DIMS_RIBBED_SIDE_THICKNESS - DIMS_BRICK_OUTER_REDUCTION),
Expand All @@ -387,7 +387,7 @@ def _create_datum_planes(self, context):
# Create back inside datum plane
back_inside_datum_plane = context.brick.newObject("PartDesign::Plane", "back_inside_datum_plane")
back_inside_datum_plane.MapReversed = False
back_inside_datum_plane.Support = [(context.brick.Origin.OriginFeatures[ORIGIN_XZ_PLANE_INDEX], '')]
back_inside_datum_plane.AttachmentSupport = [(context.brick.Origin.OriginFeatures[ORIGIN_XZ_PLANE_INDEX], '')]
back_inside_datum_plane.MapMode = 'FlatFace'
back_inside_datum_plane.AttachmentOffset = Placement(
Vector(0, 0, -1 * ((self.depth - 1) * DIMS_STUD_SPACING +
Expand All @@ -399,7 +399,7 @@ def _create_datum_planes(self, context):
# Create left inside datum plane
left_inside_datum_plane = context.brick.newObject("PartDesign::Plane", "left_inside_datum_plane")
left_inside_datum_plane.MapReversed = False
left_inside_datum_plane.Support = [(context.brick.Origin.OriginFeatures[ORIGIN_YZ_PLANE_INDEX], '')]
left_inside_datum_plane.AttachmentSupport = [(context.brick.Origin.OriginFeatures[ORIGIN_YZ_PLANE_INDEX], '')]
left_inside_datum_plane.MapMode = 'FlatFace'
left_inside_datum_plane.AttachmentOffset = Placement(
Vector(0, 0, -1 * ((DIMS_STUD_SPACING / 2) - DIMS_RIBBED_SIDE_THICKNESS - DIMS_BRICK_OUTER_REDUCTION)),
Expand All @@ -410,7 +410,7 @@ def _create_datum_planes(self, context):
# Create right inside datum plane
right_inside_datum_plane = context.brick.newObject("PartDesign::Plane", "right_inside_datum_plane")
right_inside_datum_plane.MapReversed = False
right_inside_datum_plane.Support = [(context.brick.Origin.OriginFeatures[ORIGIN_YZ_PLANE_INDEX], '')]
right_inside_datum_plane.AttachmentSupport = [(context.brick.Origin.OriginFeatures[ORIGIN_YZ_PLANE_INDEX], '')]
right_inside_datum_plane.MapMode = 'FlatFace'
right_inside_datum_plane.AttachmentOffset = Placement(
Vector(0, 0, (self.width - 1) * DIMS_STUD_SPACING +
Expand All @@ -422,7 +422,7 @@ def _create_datum_planes(self, context):
# Create depth mirror datum plane
depth_mirror_datum_plane = context.brick.newObject("PartDesign::Plane", "depth_mirror_datum_plane")
depth_mirror_datum_plane.MapReversed = False
depth_mirror_datum_plane.Support = [(context.brick.Origin.OriginFeatures[ORIGIN_XZ_PLANE_INDEX], '')]
depth_mirror_datum_plane.AttachmentSupport = [(context.brick.Origin.OriginFeatures[ORIGIN_XZ_PLANE_INDEX], '')]
depth_mirror_datum_plane.MapMode = 'FlatFace'
depth_mirror_datum_plane.AttachmentOffset = Placement(
Vector(0, 0, -1 * ((self.depth - 1) * DIMS_STUD_SPACING / 2)), Rotation(0, 0, 0))
Expand Down
8 changes: 4 additions & 4 deletions Legify/Common.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ def _render_pin_revolution(label, datum_line, body, doc):
Console.PrintMessage("_render_pin_revolution({})\n".format(label))

pin_revolution_sketch = body.newObject("Sketcher::SketchObject", label + "_pin_revolution_sketch")
pin_revolution_sketch.Support = [(datum_line, '')]
pin_revolution_sketch.AttachmentSupport = [(datum_line, '')]
pin_revolution_sketch.MapMode = 'ObjectXY'
pin_revolution_sketch.AttachmentOffset = Placement(Vector(0, 0, 0), Rotation(0, 90, 0))

Expand Down Expand Up @@ -558,7 +558,7 @@ def _render_pin_flange(label, datum_line, body, doc):
# path for additive pipe

pin_pipe_path_sketch = body.newObject("Sketcher::SketchObject", label + "_pin_pipe_path_sketch")
pin_pipe_path_sketch.Support = [(datum_line.Support[1][0]), (datum_line, '')]
pin_pipe_path_sketch.AttachmentSupport = [(datum_line.AttachmentSupport[1][0]), (datum_line, '')]
pin_pipe_path_sketch.MapMode = 'OZX'
# note 0.005 adjustment to prevent seemingly a bug in freecad rendering
pin_pipe_path_sketch.AttachmentOffset = Placement(Vector(0, 0, ((-1 * DIMS_PIN_FLANGE_DEPTH) / 2) - 0.005),
Expand Down Expand Up @@ -593,7 +593,7 @@ def _render_pin_flange(label, datum_line, body, doc):
# profile for additive pipe

pin_pipe_profile_sketch = body.newObject("Sketcher::SketchObject", label + "_pin_pipe_profile_sketch")
pin_pipe_profile_sketch.Support = [(pin_pipe_path_sketch, 'Edge1')]
pin_pipe_profile_sketch.AttachmentSupport = [(pin_pipe_path_sketch, 'Edge1')]
pin_pipe_profile_sketch.MapMode = 'ObjectXZ'

geometries = []
Expand Down Expand Up @@ -647,7 +647,7 @@ def _render_pin_notch(label, datum_line, body, doc):
# sketch for notch

pin_notch_sketch = body.newObject("Sketcher::SketchObject", label + "_pin_notch_sketch")
pin_notch_sketch.Support = [(datum_line.Support[1][0]), (datum_line, '')]
pin_notch_sketch.AttachmentSupport = [(datum_line.AttachmentSupport[1][0]), (datum_line, '')]
pin_notch_sketch.MapMode = 'OYZ'
pin_notch_sketch.AttachmentOffset = Placement(Vector(0, 0, DIMS_PIN_OUTER_RADIUS), Rotation(0, 0, 0))

Expand Down
6 changes: 3 additions & 3 deletions Legify/Holes.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def _render_holes(self):
# holes pad with cross-section meeting inside of body

holes_pad_sketch = self.brick.newObject("Sketcher::SketchObject", "holes_pad_sketch")
holes_pad_sketch.Support = (self.front_inside_datum_plane, '')
holes_pad_sketch.AttachmentSupport = (self.front_inside_datum_plane, '')
holes_pad_sketch.MapMode = 'FlatFace'

geometries = []
Expand Down Expand Up @@ -115,7 +115,7 @@ def _render_holes(self):
# holes pocket

holes_pocket_sketch = self.brick.newObject("Sketcher::SketchObject", "holes_pocket_sketch")
holes_pocket_sketch.Support = (self.front_datum_plane, '')
holes_pocket_sketch.AttachmentSupport = (self.front_datum_plane, '')
holes_pocket_sketch.MapMode = 'FlatFace'

# TODO: if/else render axle cross-section
Expand Down Expand Up @@ -144,7 +144,7 @@ def _render_holes(self):

holes_counterbore_pocket_sketch = self.brick.newObject("Sketcher::SketchObject",
"holes_counterbore_pocket_sketch")
holes_counterbore_pocket_sketch.Support = (holes_pocket_sketch, '')
holes_counterbore_pocket_sketch.AttachmentSupport = (holes_pocket_sketch, '')
holes_counterbore_pocket_sketch.MapMode = 'ObjectXY'

add_circle_to_sketch(holes_counterbore_pocket_sketch, DIMS_TECHNIC_HOLE_COUNTERBORE_RADIUS, hole_offset,
Expand Down
6 changes: 3 additions & 3 deletions Legify/Pins.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _render_pins(self, label, base_plane, backwards, count):

pin_base_datum_point = self.brick.newObject('PartDesign::Point',
'pin_base_{}_datum_point'.format(label))
pin_base_datum_point.Support = [(base_plane, '')]
pin_base_datum_point.AttachmentSupport = [(base_plane, '')]
pin_base_datum_point.MapMode = 'ObjectOrigin'
pin_base_datum_point.ViewObject.Visibility = False
if self.pins_offset:
Expand All @@ -67,7 +67,7 @@ def _render_pins(self, label, base_plane, backwards, count):

pin_tip_datum_point = self.brick.newObject('PartDesign::Point',
'pin_tip_{}_datum_point'.format(label))
pin_tip_datum_point.Support = [(base_plane, '')]
pin_tip_datum_point.AttachmentSupport = [(base_plane, '')]
pin_tip_datum_point.MapMode = 'ObjectOrigin'
pin_tip_datum_point.ViewObject.Visibility = False
if self.pins_offset:
Expand All @@ -79,7 +79,7 @@ def _render_pins(self, label, base_plane, backwards, count):
Rotation(0, 0, 0))

pin_datum_line = self.brick.newObject('PartDesign::Line', 'pin_{}_datum_line'.format(label))
pin_datum_line.Support = [(pin_base_datum_point, ''), (pin_tip_datum_point, '')]
pin_datum_line.AttachmentSupport = [(pin_base_datum_point, ''), (pin_tip_datum_point, '')]
pin_datum_line.MapMode = 'TwoPointLine'
pin_datum_line.ViewObject.Visibility = False

Expand Down
6 changes: 3 additions & 3 deletions Legify/SideStuds.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _render_side_studs_outside(self, label, plane, count, inverted):

side_studs_outside_pad_sketch = self.brick.newObject("Sketcher::SketchObject",
label + "_side_studs_outside_pad_sketch")
side_studs_outside_pad_sketch.Support = (plane, '')
side_studs_outside_pad_sketch.AttachmentSupport = (plane, '')
side_studs_outside_pad_sketch.MapMode = 'FlatFace'

add_circle_to_sketch(side_studs_outside_pad_sketch, DIMS_STUD_OUTER_RADIUS, 0,
Expand Down Expand Up @@ -75,7 +75,7 @@ def _render_side_studs_outside(self, label, plane, count, inverted):

side_studs_outside_pocket_sketch = self.brick.newObject("Sketcher::SketchObject",
label + "_side_studs_outside_pocket_sketch")
side_studs_outside_pocket_sketch.Support = (plane, '')
side_studs_outside_pocket_sketch.AttachmentSupport = (plane, '')
side_studs_outside_pocket_sketch.MapMode = 'FlatFace'

add_inner_circle_with_flats_to_sketch(side_studs_outside_pocket_sketch, DIMS_STUD_OUTER_RADIUS,
Expand Down Expand Up @@ -109,7 +109,7 @@ def _render_side_studs_inside(self, label, plane, count, inverted):

side_studs_inside_pocket_sketch = self.brick.newObject("Sketcher::SketchObject",
label + "_side_studs_inside_pocket_sketch")
side_studs_inside_pocket_sketch.Support = (plane, '')
side_studs_inside_pocket_sketch.AttachmentSupport = (plane, '')
side_studs_inside_pocket_sketch.MapMode = 'FlatFace'

add_inner_circle_with_flats_to_sketch(side_studs_inside_pocket_sketch, DIMS_STUD_OUTER_RADIUS,
Expand Down
Loading

0 comments on commit 4eac510

Please sign in to comment.