Closed shayded-exe closed 1 year ago
I just discovered that wrapping the face in a Plane
first works!
with BuildSketch(Plane(face)) as plan:
It seems that ocp_tesselate
is expecting workplanes to be actual planes, not faces here.
https://github.com/bernhard-42/ocp-tessellate/blob/0fd5aad8534932cd682818d382132c0af12aad9f/ocp_tessellate/convert.py#L639-L646
I'm not sure the ideal location for a fix. Either build123d could ensure faces get wrapped in planes sooner up the chain, or ocp_tesselate could check that it's actually dealing with a plane.
I'm just trying the example in the README and is having the same error. The example doesn't contain any BuildSketch.
from build123d import *
from ocp_vscode import *
with BuildPart() as bp:
with PolarLocations(3, 8) as locs:
Box(1, 1, 1)
show_all()
@shayded-exe Agreed, this is a bug in ocp-tessellate. btw. show(plan)
fails, show(plan.sketch)
works.
@LeLocTai I tried this on a fresh Python interpreter and it works.
Since show_all
tries to show all variables, could it be that you have some other variable in scope?
note to myself:
File [~/Development/CAD/ocp-tessellate/ocp_tessellate/convert.py:644](https://file+.vscode-resource.vscode-cdn.net/Users/bernhard/Development/CAD/build123d/~/Development/CAD/ocp-tessellate/ocp_tessellate/convert.py:644), in _to_assembly(names, colors, alphas, render_mates, render_joints, helper_scale, default_color, show_parent, loc, mates, instances, progress, is_assembly, *cad_objs)
[636] else:
[637] pg.add(part)
[639] elif (
[640] is_build123d(cad_obj)
[641] and hasattr(cad_obj, "sketch_local")
[642] and not (
[643] len(cad_obj.workplanes) == 1
--> [644] and is_plane_xy(cad_obj.workplanes[0].wrapped)
[645] )
is_plane_xy
needs to check for faces instead of planes and convert them before check
@LeLocTai I tried this on a fresh Python interpreter and it works. Since
show_all
tries to show all variables, could it be that you have some other variable in scope?
That is probably it. Sorry for the confusion.
fix with 1.2.2
It seems simply having a sketch that uses the face of a part as the workplane causes
show_all
to blow up.Here's my code:
Which produces the error:
If you change the sketch line to
with BuildSketch() as plan:
, (i.e. use the default XY workplane), it works fine.