FC 1.1.1 fixes: AttachmentSupport via PropertiesList, import Sketcher, Midplane fallback
CodeQL Analysis / Analyze (python) (push) Has been cancelled
Pre-commit Checks / Run Pre-commit Hooks (push) Has been cancelled
Docker Build / Build Docker Image (push) Failing after 2m27s
Tests / Python Tests (push) Has been cancelled
Deploy Documentation / deploy (push) Waiting to run
CodeQL Analysis / Analyze (python) (push) Has been cancelled
Pre-commit Checks / Run Pre-commit Hooks (push) Has been cancelled
Docker Build / Build Docker Image (push) Failing after 2m27s
Tests / Python Tests (push) Has been cancelled
Deploy Documentation / deploy (push) Waiting to run
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
with open("src/freecad_mcp/tools/partdesign.py", "r") as f:
|
||||
c = f.read()
|
||||
|
||||
# Revolution fix
|
||||
old1 = "rev.Symmetric = {symmetric}\nrev.Reversed = {reversed}"
|
||||
new1 = "# FC 1.1.1: use Midplane instead of Symmetric\nif \"Midplane\" in rev.PropertiesList:\n rev.Midplane = {symmetric}\nelif \"Symmetric\" in rev.PropertiesList:\n rev.Symmetric = {symmetric}\nrev.Reversed = {reversed}"
|
||||
|
||||
c = c.replace(old1, new1)
|
||||
print(f"Revolution: {'fixed' if old1 in c else 'may have issues'}")
|
||||
|
||||
# Groove fix
|
||||
old2 = "groove.Symmetric = {symmetric}\ngroove.Reversed = {reversed}"
|
||||
new2 = "# FC 1.1.1: use Midplane instead of Symmetric\nif \"Midplane\" in groove.PropertiesList:\n groove.Midplane = {symmetric}\nelif \"Symmetric\" in groove.PropertiesList:\n groove.Symmetric = {symmetric}\ngroove.Reversed = {reversed}"
|
||||
|
||||
c = c.replace(old2, new2)
|
||||
print(f"Groove: {'fixed' if old2 in c else 'may have issues'}")
|
||||
|
||||
with open("src/freecad_mcp/tools/partdesign.py", "w") as f:
|
||||
f.write(c)
|
||||
print("Done")
|
||||
@@ -95,11 +95,17 @@ if {body_name!r}:
|
||||
# Set support plane
|
||||
plane = {plane!r}
|
||||
if plane in ["XY_Plane", "XZ_Plane", "YZ_Plane"]:
|
||||
sketch.Support = (body.Origin.getObject(plane), [""])
|
||||
# FC 1.1.1: use PropertiesList check (hasattr unreliable for C++ properties)
|
||||
if "AttachmentSupport" in sketch.PropertiesList:
|
||||
sketch.AttachmentSupport = (body.Origin.getObject(plane), [""])
|
||||
else:
|
||||
sketch.Support = (body.Origin.getObject(plane), [""])
|
||||
sketch.MapMode = "FlatFace"
|
||||
elif plane.startswith("Face"):
|
||||
# Attach to face
|
||||
sketch.Support = (body, [plane])
|
||||
if "AttachmentSupport" in sketch.PropertiesList:
|
||||
sketch.AttachmentSupport = (body, [plane])
|
||||
else:
|
||||
sketch.Support = (body, [plane])
|
||||
sketch.MapMode = "FlatFace"
|
||||
else:
|
||||
# Standalone sketch
|
||||
@@ -161,6 +167,7 @@ if sketch is None:
|
||||
|
||||
# Add rectangle
|
||||
import Part
|
||||
import Sketcher
|
||||
|
||||
x, y, w, h = {x}, {y}, {width}, {height}
|
||||
|
||||
@@ -282,7 +289,11 @@ pad_name = {name!r} or "Pad"
|
||||
pad = body.newObject("PartDesign::Pad", pad_name)
|
||||
pad.Profile = sketch
|
||||
pad.Length = {length}
|
||||
pad.Symmetric = {symmetric}
|
||||
# FC 1.1.1: use Midplane instead of Symmetric
|
||||
if "Midplane" in pad.PropertiesList:
|
||||
pad.Midplane = {symmetric}
|
||||
elif "Symmetric" in pad.PropertiesList:
|
||||
pad.Symmetric = {symmetric}
|
||||
pad.Reversed = {reversed}
|
||||
|
||||
doc.recompute()
|
||||
@@ -554,7 +565,11 @@ rev_name = {name!r} or "Revolution"
|
||||
rev = body.newObject("PartDesign::Revolution", rev_name)
|
||||
rev.Profile = sketch
|
||||
rev.Angle = {angle}
|
||||
rev.Symmetric = {symmetric}
|
||||
# FC 1.1.1: use Midplane instead of Symmetric
|
||||
if "Midplane" in rev.PropertiesList:
|
||||
rev.Midplane = {symmetric}
|
||||
elif "Symmetric" in rev.PropertiesList:
|
||||
rev.Symmetric = {symmetric}
|
||||
rev.Reversed = {reversed}
|
||||
|
||||
# Set axis reference
|
||||
@@ -638,7 +653,11 @@ groove_name = {name!r} or "Groove"
|
||||
groove = body.newObject("PartDesign::Groove", groove_name)
|
||||
groove.Profile = sketch
|
||||
groove.Angle = {angle}
|
||||
groove.Symmetric = {symmetric}
|
||||
# FC 1.1.1: use Midplane instead of Symmetric
|
||||
if "Midplane" in groove.PropertiesList:
|
||||
groove.Midplane = {symmetric}
|
||||
elif "Symmetric" in groove.PropertiesList:
|
||||
groove.Symmetric = {symmetric}
|
||||
groove.Reversed = {reversed}
|
||||
|
||||
# Set axis reference
|
||||
|
||||
Reference in New Issue
Block a user