How to project drawings (TechDraw, Drawing, Export DXF, svg)

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Roland
Posts: 333
Joined: Fri Aug 21, 2015 2:20 pm

Invalid a2+-Assembly of valid objects

Post by Roland »

Hello Assemblers,

This topic rose from a topic on TechDraw. There, it was suggested that TechDraw needs "valid" shapes in order to proceed properly. (Hopefully, TechDraw will answer that question.)

The shapes that I am making are invalid (says the Parts Geometry Check). Perhaps that they are discontinuous? But they are intended the way they are. Please check the attached, as an example.

GeometryTest.FCStd is an assembly made by A2+. It contains only 1 part now: CentralBody-900. In my use case, further elements would be added using A2+. The resulting unit would be further assembled into higher levels of complexity.

For the purpose of the further analysis, I am not increasing that level of complexity now in GeometryTest.FCStd, but rather I run Parts Geometry Check. It tells me that CentralBody-900 is invalid.

The original of CentralBody-900 is a file called CentralBody-900_ass.FCStd. It contains 3 parts. Of each of those parts Parts Geometry Check tells me that they are valid. So, A2+ produces an invalid thing out of valid parts.

Questions:
What is validity?
Should we bother, in view of further model elaboration (e.g. the preparation of drawings using TechDRaw)?

Please let me know your views.
Attachments
CentralBody-900_ass.FCStd
(32.94 KiB) Downloaded 25 times
GeometryTest.FCStd
(27.07 KiB) Downloaded 22 times
Last edited by Roland on Wed Aug 28, 2019 8:11 am, edited 1 time in total.
chrisb
Veteran
Posts: 54213
Joined: Tue Mar 17, 2015 9:14 am

Re: Invalid a2+-Assembly of valid objects (was: How to project drawings (TechDraw, Drawing, Export DXF, svg))

Post by chrisb »

Roland wrote: Wed Aug 28, 2019 7:14 am My shapes are invalid. Says Geometry Check.
I split the old topic from TechDraw forum and moved this post to Assembly, where it may get the attention it deserves. Feel free to edit the subject, albeit to remove the final part in brackets.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Roland
Posts: 333
Joined: Fri Aug 21, 2015 2:20 pm

Re: How to project drawings (TechDraw, Drawing, Export DXF, svg)

Post by Roland »

Apologies for what may seem a repetition.

I would be curious to hear the view of Vocx and Wanderfan on the following:
  • Is validity important for TechDraw? (why)
  • If so, either I am doing something entirely wrong, or, hopefully, the TechDraw approach could be adapted (?).
It was suggested that TechDraw needs "valid" shapes in order to proceed properly.

The shapes that I am making are invalid (says the Parts Geometry Check). Perhaps that they are discontinuous? But they are intended the way they are. Please check the attached, as an example.

GeometryTest.FCStd is an assembly made by A2+. It contains only 1 part now: CentralBody-900. In my use case, further elements would be added using A2+. The resulting unit would be further assembled into higher levels of complexity.

For the purpose of the further analysis, I am not increasing that level of complexity now in GeometryTest.FCStd, but rather I run Parts Geometry Check. It tells me that CentralBody-900 is invalid.

The original of CentralBody-900 is a file called CentralBody-900_ass.FCStd. It contains 3 parts. Of each of those parts Parts Geometry Check tells me that they are valid. So, A2+ produces an invalid thing out of valid parts.

Questions: See above

Best regards

Roland
Attachments
GeometryTest.FCStd
(27.08 KiB) Downloaded 23 times
CentralBody-900_ass.FCStd
(32.94 KiB) Downloaded 19 times
Last edited by Roland on Wed Aug 28, 2019 8:54 am, edited 1 time in total.
chrisb
Veteran
Posts: 54213
Joined: Tue Mar 17, 2015 9:14 am

Re: How to project drawings (TechDraw, Drawing, Export DXF, svg)

Post by chrisb »

I moved it back. Splitting and merging across forums is a pain. Please edit your post and create new ones to your liking.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Roland
Posts: 333
Joined: Fri Aug 21, 2015 2:20 pm

Re: How to project drawings (TechDraw, Drawing, Export DXF, svg)

Post by Roland »

@Vocx and Wanderfan:

Thanks for your suggestions. I shall test them.

Further, please consider my questions about validity of shapes.

Best regards,

Roland
User avatar
wandererfan
Veteran
Posts: 6321
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: How to project drawings (TechDraw, Drawing, Export DXF, svg)

Post by wandererfan »

Roland wrote: Wed Aug 28, 2019 8:17 am
  • Is validity important for TechDraw? (why)
  • If so, either I am doing something entirely wrong, or, hopefully, the TechDraw approach could be adapted (?).
Is validity import? Yes, if you want to do any further OCC operations on the Shape. OCC algorithms expect a well formed shape(s) as input and don't behave well with ill formed shapes. Since TD has to do OCC operations (fuse/make compound, cut and HLR) it needs the input to be well formed.

I don't believe you are doing anything "wrong". The problem is just in the nature of assemblies. A quick example may help.

Make 2 default Part Cubes, then move 1 of them 10mm along X. We now have a minimal assembly that is aligned the way we want it. Select the 2 Cubes and use Part.makeCompound on them. Our assembly is now a single "shape". If we use Check geometry, we will see that our compound is an invalid shape, because the mating face appears twice in the Compound. In a correct shape these two contiguous Faces should be replaced by a single Face that is shared by both Cubes.

OCC has individual algorithms (ShapeFix, Sewing, etc) that will fix various conditions, but AFAICT, it doesn't have a big one-stop algorithm of the "fixEverythingWrongWithMyShape" variety. So the program has to be able to a) figure out what's wrong using OCC's ShapeAnalysis tools (this is what Check geometry does), and b) apply the appropriate strategy to correct the problem.

So long term the fix is either a) have the assembly routines produce valid OCC shapes, or b) develop a shape fixer routine to apply to input shapes before trying to work with them.
User avatar
wandererfan
Veteran
Posts: 6321
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: How to project drawings (TechDraw, Drawing, Export DXF, svg)

Post by wandererfan »

Note that this simplistic approach doesn't help. Starting with our compound of 2 Cubes,

Code: Select all

>>> c = App.ActiveDocument.Compound
>>> cs = c.Shape
>>> cf = cs.Faces
>>> shell = Part.makeShell(cf)
>>> solid = Part.makeSolid(shell)
>>> Part.show(solid)
>>> Gui.Selection.clearSelection()
>>> Gui.Selection.addSelection('_CubeCompound','Shape')
>>> Gui.runCommand('Part_CheckGeometry',0)
>>> Gui.Selection.clearSelection()
The resulting solid contains 12 Faces and is invalid. It should only contain 11 Faces. The duplicate mating Faces should be replaced by a single Face shared by the 2 Cubes.
User avatar
Roland
Posts: 333
Joined: Fri Aug 21, 2015 2:20 pm

Re: How to project drawings (TechDraw, Drawing, Export DXF, svg)

Post by Roland »

Dear Wanderfan,

I cannot reproduce your analysis of the 2 cubes.

Two facing cubes, compounded, yield 1 valid shape for me. File attached.

(Note this is before you gave the code. I shall check that as well.)

Greetz

Roland
Attachments
Compound.FCStd
(6.9 KiB) Downloaded 24 times
User avatar
Roland
Posts: 333
Joined: Fri Aug 21, 2015 2:20 pm

Re: How to project drawings (TechDraw, Drawing, Export DXF, svg)

Post by Roland »

Stupidly enough, Wanderfan, I do not know how to use your code. I pasted it in the python console. Just got plenty of errors.

Sorry,

Roland
Post Reply