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

Arch: Arch_Structure beam could have wrong length #13399

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 11 additions & 8 deletions src/Mod/Arch/ArchStructure.py
@@ -1,4 +1,4 @@
#***************************************************************************

Check warning on line 1 in src/Mod/Arch/ArchStructure.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

would reformat src/Mod/Arch/ArchStructure.py
#* Copyright (c) 2011 Yorik van Havre <yorik@uncreated.net> *
#* *
#* This program is free software; you can redistribute it and/or modify *
Expand Down Expand Up @@ -165,7 +165,7 @@

def placeAlongEdge(p1,p2,horizontal=False):

"""placeAlongEdge(p1,p2,[horizontal]): returns a Placement positioned at p1, with Z axis oriented towards p2.

Check warning on line 168 in src/Mod/Arch/ArchStructure.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Line too long (113/100) (line-too-long)
If horizontal is True, then the X axis is oriented towards p2, not the Z axis"""

pl = FreeCAD.Placement()
Expand All @@ -180,7 +180,7 @@
pl.Rotation = FreeCAD.Rotation(zaxis,yaxis,xaxis,"ZXY")
else:
pl.Rotation = FreeCAD.Rotation(xaxis,yaxis,zaxis,"ZXY")
pl.Rotation = FreeCAD.Rotation(pl.Rotation.multVec(FreeCAD.Vector(0,0,1)),90).multiply(pl.Rotation)

Check warning on line 183 in src/Mod/Arch/ArchStructure.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Line too long (111/100) (line-too-long)
return pl


Expand All @@ -192,8 +192,8 @@

def GetResources(self):
return {'Pixmap': 'Arch_MultipleStructures',
'MenuText': QT_TRANSLATE_NOOP("Arch_StructuresFromSelection", "Multiple Structures"),

Check warning on line 195 in src/Mod/Arch/ArchStructure.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Line too long (101/100) (line-too-long)
'ToolTip': QT_TRANSLATE_NOOP("Arch_StructuresFromSelection", "Create multiple Arch Structures from a selected base, using each selected edge as an extrusion path")}

Check warning on line 196 in src/Mod/Arch/ArchStructure.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Line too long (180/100) (line-too-long)

def IsActive(self):
return not FreeCAD.ActiveDocument is None
Expand All @@ -201,18 +201,18 @@
def Activated(self):
selex = FreeCADGui.Selection.getSelectionEx()
if len(selex) >= 2:
FreeCAD.ActiveDocument.openTransaction(translate("Arch", "Create Structures From Selection"))

Check warning on line 204 in src/Mod/Arch/ArchStructure.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Line too long (105/100) (line-too-long)
FreeCADGui.addModule("Arch")
FreeCADGui.addModule("Draft")
base = selex[0].Object # The first selected object is the base for the Structure objects
for selexi in selex[1:]: # All the edges from the other objects are used as a Tool (extrusion paths)

Check warning on line 208 in src/Mod/Arch/ArchStructure.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Line too long (112/100) (line-too-long)
if len(selexi.SubElementNames) == 0:
subelement_names = ["Edge" + str(i) for i in range(1, len(selexi.Object.Shape.Edges) + 1)]

Check warning on line 210 in src/Mod/Arch/ArchStructure.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Line too long (110/100) (line-too-long)
else:
subelement_names = [sub for sub in selexi.SubElementNames if sub.startswith("Edge")]

Check warning on line 212 in src/Mod/Arch/ArchStructure.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Line too long (104/100) (line-too-long)
for sub in subelement_names:
FreeCADGui.doCommand("structure = Arch.makeStructure(FreeCAD.ActiveDocument." + base.Name + ")")

Check warning on line 214 in src/Mod/Arch/ArchStructure.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Line too long (116/100) (line-too-long)
FreeCADGui.doCommand("structure.Tool = (FreeCAD.ActiveDocument." + selexi.Object.Name + ", '" + sub + "')")

Check warning on line 215 in src/Mod/Arch/ArchStructure.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Line too long (127/100) (line-too-long)
FreeCADGui.doCommand("structure.BasePerpendicularToTool = True")
FreeCADGui.doCommand("Draft.autogroup(structure)")
FreeCAD.ActiveDocument.commitTransaction()
Expand Down Expand Up @@ -349,6 +349,9 @@
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Structure"))
FreeCADGui.addModule("Arch")
FreeCADGui.addModule("WorkingPlane")
if self.bmode:
self.Length = point.sub(self.bpoint).Length
params.set_param_arch("StructureHeight",self.Length)
if self.Profile is not None:
try: # try to update latest precast values - fails if dialog has been destroyed already
self.precastvalues = self.precast.getValues()
Expand Down Expand Up @@ -649,17 +652,17 @@

def rotateLH(self):

h = self.Height
l = self.Length
self.vLength.setText(FreeCAD.Units.Quantity(h,FreeCAD.Units.Length).UserString)
self.vHeight.setText(FreeCAD.Units.Quantity(l,FreeCAD.Units.Length).UserString)
l = self.vLength.text()
h = self.vHeight.text()
self.vLength.setText(h)
self.vHeight.setText(l)

def rotateLW(self):

w = self.Width
l = self.Length
self.vLength.setText(FreeCAD.Units.Quantity(w,FreeCAD.Units.Length).UserString)
self.vWidth.setText(FreeCAD.Units.Quantity(l,FreeCAD.Units.Length).UserString)
l = self.vLength.text()
w = self.vWidth.text()
self.vLength.setText(w)
self.vWidth.setText(l)


class _Structure(ArchComponent.Component):
Expand Down Expand Up @@ -994,8 +997,8 @@
offset = FreeCAD.Vector(0,0,obj.NodesOffset.Value)
if obj.Nodes and (prop != "ResetNodes"):
if hasattr(self,"nodes"):
if self.nodes:

Check failure on line 1000 in src/Mod/Arch/ArchStructure.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Access to member 'nodes' before its definition line 1008 (access-member-before-definition)
if obj.Nodes != self.nodes:

Check failure on line 1001 in src/Mod/Arch/ArchStructure.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Access to member 'nodes' before its definition line 1008 (access-member-before-definition)
# nodes are set manually: don't touch them
return
else:
Expand Down Expand Up @@ -1107,7 +1110,7 @@

if prop == "ShowNodes":
if hasattr(self,"nodes"):
vobj.Annotation.removeChild(self.nodes)

Check failure on line 1113 in src/Mod/Arch/ArchStructure.py

View workflow job for this annotation

GitHub Actions / Lint / Lint

Access to member 'nodes' before its definition line 1117 (access-member-before-definition)
del self.nodes
if vobj.ShowNodes:
from pivy import coin
Expand Down