Support for assembly2 continuing
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Support for assembly2 continuing
after this PR in FreeCAD 0.17
https://github.com/FreeCAD/FreeCAD/pull/359
Path: Changed Part.Line to Part.LineSegment #359
Assembly2 will not work for some constraints related to:
Curves, Lines, Edges
in FC 0.17 from release 9123
any help from FC gurus would be highly appreciate
thx
Maurice
PS assembly2 in FC 0.16 is still fine
https://github.com/FreeCAD/FreeCAD/pull/359
Path: Changed Part.Line to Part.LineSegment #359
Assembly2 will not work for some constraints related to:
Curves, Lines, Edges
in FC 0.17 from release 9123
any help from FC gurus would be highly appreciate
thx
Maurice
PS assembly2 in FC 0.16 is still fine
Re: Support for assembly2 continuing
Have a look at the discussion here: viewtopic.php?f=10&t=18767&p=147194#p147194
Bascially now Part.Line is infinite.
There might be changes needed in Assembly2, but we need to isolate exactly where the errors happen
Bascially now Part.Line is infinite.
There might be changes needed in Assembly2, but we need to isolate exactly where the errors happen
Re: Support for assembly2 continuing
Hi @yorikyorik wrote:Have a look at the discussion here: viewtopic.php?f=10&t=18767&p=147194#p147194
Bascially now Part.Line is infinite.
There might be changes needed in Assembly2, but we need to isolate exactly where the errors happen
thx for your prompt reply
the issues are related to this file:
https://github.com/hamish2014/FreeCAD_a ... bly2lib.py
with the function
LinearEdgeSelected
CircularEdgeSelected
getSubElementPos
the errors come when applying an Axial constraint for edges (using previous release) or for edges and planes (using latest assembly2)
Just substituting
Code: Select all
Part.Line
Code: Select all
Part.LineSegment
Moreover there will be still warning messages in FC017 related to Curve
Code: Select all
DeprecationWarning: For future usage 'Curve' will return 'Line' which is infinite instead of the limited 'LineSegment'.
If you need a line segment then use this:
Part.LineSegment(edge.Curve,edge.FirstParameter,edge.LastParameter)To suppress the warning set BaseApp/Preferences/Mod/Part/General/LineOld to false
Maurice
Re: Support for assembly2 continuing
the solution we're now applying everywhere is to replace all
with
Code: Select all
isinstance(something,Part.Line)
Code: Select all
isinstance(something,(Part.Line,Part.LineSegment))
Re: Support for assembly2 continuing
very elegant solution!yorik wrote:the solution we're now applying everywhere is to replace allwithCode: Select all
isinstance(something,Part.Line)
Code: Select all
isinstance(something,(Part.Line,Part.LineSegment))
I'm going to make a PR asap
thx a lot for this great software!
Maurice
Re: Support for assembly2 continuing
Hi @yorik
oops ... it seems I tested too fast/roughly ...
changing the code to
in FC 0.17 9123 the constraint work, but I still get this error/warning:
and in FC 0.16 6706 the constraint doesn't work and I get this error:
and here the updated repo:
https://github.com/easyw/FreeCAD_assembly2/tree/dev thx again
Maurice
oops ... it seems I tested too fast/roughly ...
changing the code to
Code: Select all
isinstance(something,(Part.Line,Part.LineSegment))
Code: Select all
DeprecationWarning: For future usage 'Curve' will return 'Line' which is infinite instead of the limited 'LineSegment'.
If you need a line segment then use this:
Part.LineSegment(edge.Curve,edge.FirstParameter,edge.LastParameter)To suppress the warning set BaseApp/Preferences/Mod/Part/General/LineOld to false
Code: Select all
addSelection: docName,obj.Label,sub = testPline2,cylinder_01,Face1
Traceback (most recent call last):
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 8, in allow
return ValidSelection(SelectionExObject(doc, obj, sub))
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 12, in ValidSelection
or LinearEdgeSelected(selectionExObj)\
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\assembly2lib.py", line 352, in LinearEdgeSelected
if isinstance(edge.Curve, (Part.Line,Part.LineSegment)):
<type 'exceptions.AttributeError'>: 'module' object has no attribute 'LineSegment'
Traceback (most recent call last):
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 8, in allow
return ValidSelection(SelectionExObject(doc, obj, sub))
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 12, in ValidSelection
or LinearEdgeSelected(selectionExObj)\
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\assembly2lib.py", line 352, in LinearEdgeSelected
if isinstance(edge.Curve, (Part.Line,Part.LineSegment)):
<type 'exceptions.AttributeError'>: 'module' object has no attribute 'LineSegment'
Traceback (most recent call last):
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 8, in allow
return ValidSelection(SelectionExObject(doc, obj, sub))
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 12, in ValidSelection
or LinearEdgeSelected(selectionExObj)\
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\assembly2lib.py", line 352, in LinearEdgeSelected
if isinstance(edge.Curve, (Part.Line,Part.LineSegment)):
<type 'exceptions.AttributeError'>: 'module' object has no attribute 'LineSegment'
Traceback (most recent call last):
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 8, in allow
return ValidSelection(SelectionExObject(doc, obj, sub))
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 12, in ValidSelection
or LinearEdgeSelected(selectionExObj)\
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\assembly2lib.py", line 352, in LinearEdgeSelected
if isinstance(edge.Curve, (Part.Line,Part.LineSegment)):
<type 'exceptions.AttributeError'>: 'module' object has no attribute 'LineSegment'
Traceback (most recent call last):
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 8, in allow
return ValidSelection(SelectionExObject(doc, obj, sub))
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 12, in ValidSelection
or LinearEdgeSelected(selectionExObj)\
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\assembly2lib.py", line 352, in LinearEdgeSelected
if isinstance(edge.Curve, (Part.Line,Part.LineSegment)):
<type 'exceptions.AttributeError'>: 'module' object has no attribute 'LineSegment'
Traceback (most recent call last):
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 8, in allow
return ValidSelection(SelectionExObject(doc, obj, sub))
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 12, in ValidSelection
or LinearEdgeSelected(selectionExObj)\
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\assembly2lib.py", line 352, in LinearEdgeSelected
if isinstance(edge.Curve, (Part.Line,Part.LineSegment)):
<type 'exceptions.AttributeError'>: 'module' object has no attribute 'LineSegment'
Traceback (most recent call last):
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 8, in allow
return ValidSelection(SelectionExObject(doc, obj, sub))
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 12, in ValidSelection
or LinearEdgeSelected(selectionExObj)\
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\assembly2lib.py", line 352, in LinearEdgeSelected
if isinstance(edge.Curve, (Part.Line,Part.LineSegment)):
<type 'exceptions.AttributeError'>: 'module' object has no attribute 'LineSegment'
Traceback (most recent call last):
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 8, in allow
return ValidSelection(SelectionExObject(doc, obj, sub))
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 12, in ValidSelection
or LinearEdgeSelected(selectionExObj)\
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\assembly2lib.py", line 352, in LinearEdgeSelected
if isinstance(edge.Curve, (Part.Line,Part.LineSegment)):
<type 'exceptions.AttributeError'>: 'module' object has no attribute 'LineSegment'
Traceback (most recent call last):
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 8, in allow
return ValidSelection(SelectionExObject(doc, obj, sub))
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 12, in ValidSelection
or LinearEdgeSelected(selectionExObj)\
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\assembly2lib.py", line 352, in LinearEdgeSelected
if isinstance(edge.Curve, (Part.Line,Part.LineSegment)):
<type 'exceptions.AttributeError'>: 'module' object has no attribute 'LineSegment'
Traceback (most recent call last):
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 8, in allow
return ValidSelection(SelectionExObject(doc, obj, sub))
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 12, in ValidSelection
or LinearEdgeSelected(selectionExObj)\
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\assembly2lib.py", line 352, in LinearEdgeSelected
if isinstance(edge.Curve, (Part.Line,Part.LineSegment)):
<type 'exceptions.AttributeError'>: 'module' object has no attribute 'LineSegment'
Traceback (most recent call last):
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 8, in allow
return ValidSelection(SelectionExObject(doc, obj, sub))
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 12, in ValidSelection
or LinearEdgeSelected(selectionExObj)\
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\assembly2lib.py", line 352, in LinearEdgeSelected
if isinstance(edge.Curve, (Part.Line,Part.LineSegment)):
<type 'exceptions.AttributeError'>: 'module' object has no attribute 'LineSegment'
Traceback (most recent call last):
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 8, in allow
return ValidSelection(SelectionExObject(doc, obj, sub))
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 12, in ValidSelection
or LinearEdgeSelected(selectionExObj)\
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\assembly2lib.py", line 352, in LinearEdgeSelected
if isinstance(edge.Curve, (Part.Line,Part.LineSegment)):
<type 'exceptions.AttributeError'>: 'module' object has no attribute 'LineSegment'
Traceback (most recent call last):
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 8, in allow
return ValidSelection(SelectionExObject(doc, obj, sub))
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 12, in ValidSelection
or LinearEdgeSelected(selectionExObj)\
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\assembly2lib.py", line 352, in LinearEdgeSelected
if isinstance(edge.Curve, (Part.Line,Part.LineSegment)):
<type 'exceptions.AttributeError'>: 'module' object has no attribute 'LineSegment'
addSelection: docName,obj.Label,sub = testPline2,cube_transparent_01,Edge6
Traceback (most recent call last):
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\assembly2lib.py", line 61, in addSelection
self.parseSelectionFunction( self.selections)
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 20, in parseSelection
if ValidSelection(s1) and ValidSelection(s2):
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\axialConstraint.py", line 12, in ValidSelection
or LinearEdgeSelected(selectionExObj)\
File "C:\Users\userM\AppData\Roaming\FreeCAD\Mod\FreeCAD_assembly2-PLinenew\assembly2lib.py", line 352, in LinearEdgeSelected
if isinstance(edge.Curve, (Part.Line,Part.LineSegment)):
<type 'exceptions.AttributeError'>: 'module' object has no attribute 'LineSegment'
https://github.com/easyw/FreeCAD_assembly2/tree/dev thx again
Maurice
Re: Support for assembly2 continuing
The new code is not available in FreeCAD 0.16. So there is a problem for macro authors, having to support macros for FreeCAD 0.17 and FreeCAD 0.16. We now need two different versions of a macro or make a lot if-cases with different code for FreeCAD 0.17 and FreeCAD 0.16.easyw-fc wrote:and in FC 0.16 6706 the constraint doesn't work and I get this error:
I do actually not remember, how to check the FreeCAD-Version but this needs then to be in a macro.
Ulrich
Re: Support for assembly2 continuing
please note that this option would require also a check on 0.17 release nbr, because FC 0.17 is not supporting the new code before release 9123...ulrich1a wrote:The new code is not available in FreeCAD 0.16. So there is a problem for macro authors, having to support macros for FreeCAD 0.17 and FreeCAD 0.16. We now need two different versions of a macro or make a lot if-cases with different code for FreeCAD 0.17 and FreeCAD 0.16.easyw-fc wrote:and in FC 0.16 6706 the constraint doesn't work and I get this error:
I do actually not remember, how to check the FreeCAD-Version but this needs then to be in a macro.
Ulrich
an other option would be in something like
Code: Select all
try:
except:
any suggestion would be greatly appreciate
Maurice
Re: Support for assembly2 continuing
You are right in this point. But as all users which work with a 0.17 release are using development releases, I would expect, that those can be asked to use a more actual one.easyw-fc wrote:please note that this option would require also a check on 0.17 release nbr, because FC 0.17 is not supporting the new code before release 9123...
Ulrich
Re: Support for assembly2 continuing
you could make a helper function like this, that should work for both 0.16 and 0.17:
Code: Select all
def isLine(something):
if hasattr(Part,"LineSegment"):
return isinstance(something,(Part.Line,Part.LineSegment))
else:
return isinstance(something,Part.Line)