Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Problem] Part: FeatureExtrusion.cpp issue with Draft_Wires #7387

Open
2 tasks done
Roy-043 opened this issue Aug 22, 2022 · 3 comments
Open
2 tasks done

[Problem] Part: FeatureExtrusion.cpp issue with Draft_Wires #7387

Roy-043 opened this issue Aug 22, 2022 · 3 comments
Labels
Bug This issue or PR is related to a bug WB Draft Related to the Draft Workbench WB Part Related to the Part Workbench

Comments

@Roy-043
Copy link
Contributor

Roy-043 commented Aug 22, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Forums discussion

https://forum.freecadweb.org/viewtopic.php?p=619535#p619535

Version

0.21 (Development)

Full version info

OS: Windows 8.1 Version 6.3 (Build 9600)
Word size of FreeCAD: 64-bit
Version: 0.21.30143 (Git)
Build type: Release
Branch: master
Hash: a72bf218f9917df37e811d7e73a36333282028f5
Python 3.8.13, Qt 5.15.4, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.2
Locale: Dutch/Netherlands (nl_NL)
Installed mods: 

Subproject(s) affected?

Part

Issue description

The Extrusion::calculateShapeNormal function assumes that the shape of a Part::Part2DObject always lies on the XY plane of the coordinate system defined by its Placement. For a Draft Wire that need not be the case.

//special case for sketches and the like: no matter what shape they have, use their local Z axis.
if (docobj->isDerivedFrom(Part::Part2DObject::getClassTypeId())) {
Base::Vector3d OZ(0.0, 0.0, 1.0);
Base::Vector3d result;
Base::Rotation(mat).multVec(OZ, result);
return result;
}

Test code:

import FreeCAD as App
import Draft

doc = App.ActiveDocument

pts = [App.Vector (0.0, 0.0, 0.0), 
       App.Vector (5.0, 0.0, 3.0),
       App.Vector (5.0, 5.0, 0.0)]
       
wire1 = Draft.make_wire(pts)
wire1.Closed = True
wire1.MakeFace = False
doc.recompute()

extr1 = doc.addObject("Part::Extrusion", "Extrude_wire1")
extr1.Base = wire1
extr1.DirMode = "Normal"
extr1.LengthFwd = 2.0
extr1.Solid = True
doc.recompute()

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@luzpaz luzpaz added WB Draft Related to the Draft Workbench WB Part Related to the Part Workbench Bug This issue or PR is related to a bug labels Aug 22, 2022
@yorikvanhavre
Copy link
Member

Draft Wires are not necessarily 2D (I use this often, for ex. to draw plumbing lines). IIRC they are Part::Feature, not Part::Part2DObject. Even if the automatic shape direction does not work, Extrusions still work ok...

Not sure how to proceed here... But it's not rally a bug IMHO

@yorikvanhavre
Copy link
Member

I'll remove this one from the 0.21 release project because I think it's deeper than just a bug fix

@Roy-043
Copy link
Contributor Author

Roy-043 commented May 9, 2023

This is definitely a bug.

Draft_Wires really are Part::Part2DObject objects. And yes they can contain 3D wires, which is of course confusing.

In the case of the example the wire is triangular and therefore planar, so extruding it should be possible.

Just removing the referenced code will already fix the problem. Alternatively the 'special case' code can target sketch objects only. This seems like an easy fix to me...

On a principle level: Draft Wires, BSplines and BezCurves should probably not be Part::Part2DObject objects. Changing that would be more fundamental and should not be attempted for the V0.21 release.

@luzpaz luzpaz changed the title [Bug] Part: FeatureExtrusion.cpp issue with Draft_Wires [Problem] Part: FeatureExtrusion.cpp issue with Draft_Wires Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This issue or PR is related to a bug WB Draft Related to the Draft Workbench WB Part Related to the Part Workbench
Projects
None yet
Development

No branches or pull requests

3 participants