Make column and gridline with "App::InventorObject" and set Buffer property with inventor file's string.
I try to learn the inventor file format before use pivy.coin attach to the object node.
--------------------
The inventor file format is like VRML 1.0
Replace first line from "#VRML V1.0 ascii" with "#Inventor V2.1 ascii"
VRML 1.0 - Examples
The Virtual Reality Modeling Language
VRML 1.0 (old) extensions
OpenInventor
pivy/examples/Mentor/
The Inventor Mentor: Programming Object-Oriented 3D Graphics with Open Inventor™, Release 2
Coin Documentation
Make structural object in "App::InventorObject"
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Make structural object in "App::InventorObject"
- Attachments
-
- ColumnIV.py
- (5.35 KiB) Downloaded 70 times
-
- InventorObject_01.FCStd
- (3.31 KiB) Downloaded 72 times
Last edited by chakkree on Tue Jul 14, 2020 5:59 am, edited 3 times in total.
Re: Make structural object in "App::InventorObject"
These URLs are invalidchakkree wrote: ↑Mon Jul 13, 2020 3:01 am The inventor file format is like VRML 1.0
Replace first line from "#VRML V1.0 ascii" with "#Inventor V2.1 ascii"
VRML 1.0 - Examples
The Virtual Reality Modeling Language
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: Make structural object in "App::InventorObject"
Yea, no worries. The bbcode isn't very intuitive.
re:VRML
maybe we should think of starting to document this on the FreeCAD wiki ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: Make structural object in "App::InventorObject"
**Test concept before moved to pivy.coin**
------------------------------------------------------
Create an Isolated foundation model with Inventor string, set to Buffer property of App:: InventorObject.
The Inventor string made by a python script that can change the size of footing, number, and diameter of the rebars.
------------------------------------------------------
Create an Isolated foundation model with Inventor string, set to Buffer property of App:: InventorObject.
The Inventor string made by a python script that can change the size of footing, number, and diameter of the rebars.
Code: Select all
"""
RebarIV.py
make Isolated Footing with rebars with App::InventorObject
chakkree tiyawongsuwan, 15 Jul 2020
"""
from FreeCAD import Vector
from math import radians, cos, sin , pi
from numpy import arange
def crossSection(dia):
R = dia/2
n = 16
step = 360/16
retStr = ''
for i in range(0,n+1):
angle = i*step
x = R* cos(radians(angle))
y = R* sin(radians(angle))
retStr += '%.3f'%x + ' ' + '%.3f'%y + ','
return retStr
# 135 Hook
def stirrupSpine(dia, A, B):
r = dia/2
Rf = (2.5)*dia
Lh = dia*4
A -= dia; B -=dia
#
x = A/2 -Rf +Rf*cos(pi/4) -Lh*cos(pi/4)
y = B/2 -Rf -Rf*cos(pi/4) -Lh*cos(pi/4)
retStr = '%0.3f'%x + ' ' + '%0.3f'%y + ' %.3f,'%(-dia/2)
for i in arange(-45, 90+0.1, 15 ):
dx = Rf*cos(radians(i))
dy = Rf*sin(radians(i))
x = A/2 -Rf + dx
y = B/2 -Rf + dy
retStr += '%0.3f'%x + ' ' + '%0.3f'%y + ' %.3f,'%(-dia/2)
for i in arange( 90 , 180+0.1 , 15 ):
dx = Rf*cos(radians(i))
dy = Rf*sin(radians(i))
x = -A/2 +Rf + dx
y = B/2 -Rf + dy
retStr += '%0.3f'%x + ' ' + '%0.3f'%y + ' 0,'
for i in arange( 180 , 270+0.1 , 15 ):
dx = Rf*cos(radians(i))
dy = Rf*sin(radians(i))
x = -A/2 +Rf + dx
y = -B/2 +Rf + dy
retStr += '%0.3f'%x + ' ' + '%0.3f'%y + ' 0,'
for i in arange( 270 , 360+0.1 , 15 ):
dx = Rf*cos(radians(i))
dy = Rf*sin(radians(i))
x = A/2 -Rf + dx
y = -B/2 +Rf + dy
retStr += '%0.3f'%x + ' ' + '%0.3f'%y + ' 0,'
for i in arange( 0 , 90+45+0.1 , 15 ):
dx = Rf*cos(radians(i))
dy = Rf*sin(radians(i))
x = A/2 -Rf + dx
y = B/2 -Rf + dy
retStr += '%0.3f'%x + ' ' + '%0.3f'%y + ' %.3f,'%(+dia/2+1)
x = A/2 -Rf -Rf*cos(pi/4) -Lh*cos(pi/4)
y = B/2 -Rf +Rf*cos(pi/4) -Lh*cos(pi/4)
retStr += '%0.3f'%x + ' ' + '%0.3f'%y + ' %.3f,'%(dia/2+1)
return retStr
def stirrupSpine90(dia, A, B , tran):
r = dia/2
Rf = (2.5)*dia
Lh = dia*4
A -= dia; B -=dia
#
x = A/2 #-Rf +Rf*cos(pi/4) -Lh*cos(pi/4)
y = B/2 -Rf -Lh #-Rf*cos(pi/4) -Lh*cos(pi/4)
retStr = '%0.3f'%x + ' ' + '%0.3f'%y + ' %.3f,'%(-dia/2)
for i in arange(0, 90+0.1, 15 ):
dx = Rf*cos(radians(i))
dy = Rf*sin(radians(i))
x = A/2 -Rf + dx
y = B/2 -Rf + dy
retStr += '%0.3f'%x + ' ' + '%0.3f'%y + ' %.3f,'%(-dia/2)
for i in arange( 90 , 180+0.1 , 15 ):
dx = Rf*cos(radians(i))
dy = Rf*sin(radians(i))
x = -A/2 +Rf + dx
y = B/2 -Rf + dy
retStr += '%0.3f'%x + ' ' + '%0.3f'%y + ' 0,'
for i in arange( 180 , 270+0.1 , 15 ):
dx = Rf*cos(radians(i))
dy = Rf*sin(radians(i))
x = -A/2 +Rf + dx
y = -B/2 +Rf + dy
retStr += '%0.3f'%x + ' ' + '%0.3f'%y + ' 0,'
for i in arange( 270 , 360+0.1 , 15 ):
dx = Rf*cos(radians(i))
dy = Rf*sin(radians(i))
x = A/2 -Rf + dx
y = -B/2 +Rf + dy
retStr += '%0.3f'%x + ' ' + '%0.3f'%y + ' 0,'
for i in arange( 0 , 90+0.1 , 15 ):
dx = Rf*cos(radians(i))
dy = Rf*sin(radians(i))
x = A/2 -Rf + dx
y = B/2 -Rf + dy
retStr += '%0.3f'%x + ' ' + '%0.3f'%y + ' %.3f,'%(+dia/2+1)
x = A/2 -Rf-Lh#-Rf -Rf*cos(pi/4) -Lh*cos(pi/4)
y = B/2 # +Rf*cos(pi/4) -Lh*cos(pi/4)
retStr += '%0.3f'%x + ' ' + '%0.3f'%y + ' %.3f,'%(dia/2+1)
return retStr
def get_UShape_Spine(A, B ,C , R):
retStr = '0 %g 0,' %A
n = 6
step = 90./n
for i in range(0,n+1):
Angle = radians(i*step )
dx = R * cos(Angle)
dy = R * sin(Angle)
x = R-dx
y = R-dy
retStr += '%g %g 0,'%(x,y)
retStr += '%g 0 0,'%(B-R)
for i in range(0,n+1):
Angle = radians(i*step )
dx = R * sin(Angle)
dy = R * cos(Angle)
x = B-R+dx
y = R-dy
retStr += '%g %g 0,'%(x,y)
retStr += '%g %g 0,'%(B, C)
return retStr
def get_LShape_Column_Spine(A , B ,R):
retStr = '0 %g 0,' %A
n = 6
step = 90./n
for i in range(0,n+1):
Angle = radians(i*step )
dx = R * cos(Angle)
dy = R * sin(Angle)
x = +R-dx
y = +R-dy
retStr += '%g %g 0,'%(x,y)
retStr += '%g 0 0,' %(B)
return retStr
def getUShapeRebarSet1( dia, n, spacing , A,B,C , tran):
dy = tran[1]
dz=tran[2]
retStr = """DEF REBAR_SET1 Array{
origin CENTER
numElements2 %d
separation2 %f 0 0
DEF REBAR_01 Separator {
Transform { rotation 0.58 0.58 0.58 2.09439 translation 0 %f %f }
Material { diffuseColor 0.0 0.000 0.667 specularColor 1 1 1 }
VRMLExtrusion {
beginCap TRUE
endCap TRUE
creaseAngle 0
"""%(n, spacing , dy , dz)
retStr += 'spine [ ' + get_UShape_Spine(A, B ,C , R=3*dia)+ '\n ]\n'
retStr += ' crossSection [\n' + crossSection(dia) + '\n ]\n'
retStr += """
}
}
}
"""
return retStr
def getUShapeRebarSet2( dia, n, spacing , A,B,C , tran):
dx = tran[0]
dz=tran[2]
retStr = """DEF REBAR_SET1 Array{
origin CENTER
numElements2 %d
separation2 0 %f 0
DEF REBAR_01 Separator {
Transform { rotation 1 0 0 1.5708 translation %f 0 %f }
Material { diffuseColor 0.0 0.667 0.0 specularColor 1 1 1 }
VRMLExtrusion {
beginCap TRUE
endCap TRUE
creaseAngle 0
"""%(n, spacing , dx , dz)
retStr += 'spine [ ' + get_UShape_Spine(A, B ,C , R=3*dia) + '\n ]\n'
retStr += ' crossSection [\n' + crossSection(dia) + '\n ]\n'
retStr += """
}
}
}
"""
return retStr
def getPileCapStirrup(dia,A,B,tran):
#stirrupSpine90(dia, A, B)
strIV = """DEF STIRRUP Separator {
Transform { translation 0 0 -90}
Material { diffuseColor 0.667 0.000 0.0 specularColor 1 1 1 }
VRMLExtrusion {
beginCap TRUE
endCap TRUE
creaseAngle 0
"""
strIV += 'spine [ ' + stirrupSpine90(dia, A, B , tran) + '\n ]\n'
strIV += ' crossSection [\n' + crossSection(dia) + '\n ]\n'
strIV += """
}
}"""
return strIV
def CubeConcrete_IV(B,L,t):
def getPointCube():
strPts = '%g %g %g,'%(-B/2, -L/2 , -t/2)
strPts += '%g %g %g,'%(B/2, -L/2 , -t/2)
strPts += '%g %g %g,'%(B/2, L/2 , -t/2)
strPts += '%g %g %g,'%(-B/2, L/2 , -t/2)
strPts += '%g %g %g,'%(-B/2, -L/2 , t/2)
strPts += '%g %g %g,'%(B/2, -L/2 , t/2)
strPts += '%g %g %g,'%(B/2, L/2 , t/2)
strPts += '%g %g %g,'%(-B/2, L/2 , t/2)
return strPts
strIV ='''DEF CONCRETE Separator {
Transform { translation 0 0 %g }
Separator {
Material {
diffuseColor 0.7 0.7 0.7
transparency 0.7
}
Cube{
width %g
height %g
depth %g
}
}
Separator {
Material {
diffuseColor 0 0 0
}
DrawStyle {
style LINES
lineWidth 2
linePattern 0xffff
}
Coordinate3 {
point [
'''%(-t/2, B,L,t)
strIV +=getPointCube()
strIV +='''
]
}
IndexedLineSet {
coordIndex [0,1,2,3,0,-1 , 4,5,6,7,4,-1 , 0,4,-1, 1,5,-1,2,6,-1,3,7,-1]
}
}
}
'''
return strIV
def PileCap_2Pile_IV( B=500, L=1150, t = 500 , covering=(50,50) ,
rebarLong=[16,5] , rebarShort=[16,5] , rebarStir=[12]):
srtIV = '#Inventor V2.1 ascii\n'
srtIV += '# PileCap_2Pile_IV\n'
srtIV += '# Chakkree Tiyawongsuwan\n'
srtIV += CubeConcrete_IV(B,L,t)
dia1 = rebarLong[0]; n = rebarLong[1]
A = t -covering[0]-covering[1]; C =A
B_rb = L -2*covering[0]
spacing = ( B - 2*covering[0] - 2*3*dia1 ) / (n-1)
tran = (0, -L/2+covering[0] , -t + covering[1])
srtIV += getUShapeRebarSet1(dia1,n, spacing , A,B_rb,C , tran )
dia2 = rebarShort[0]; n = rebarShort[1]
A = t -covering[0]-covering[1] - dia1; C =A
B_rb2 = B -2*covering[0]
spacing = ( L - 2*covering[0] - 2*3*dia2 ) / (n-1)
tran = (-B/2+covering[0], 0 , 0-t + covering[1] +dia1/2+dia2/2)
srtIV += getUShapeRebarSet2(dia2,n, spacing , A,B_rb2,C , tran )
dia3 = rebarStir[0]
A = B-2*covering[0]-dia2
B_rb3 = L -2*covering[0]-dia1
tran = (0,0,0)
srtIV += getPileCapStirrup(dia3,A,B_rb3,tran)
return srtIV
def makePileCap_2Pile_IV(B=500, L=1150, t = 500 , covering=(50,50) ,
rebarLong=[16,5] , rebarShort=[16,5] , rebarStir=[12]):
ivObj=FreeCAD.ActiveDocument.addObject("App::InventorObject","PileCap_2Pile")
ivObj.Buffer = PileCap_2Pile_IV(B, L, t , covering ,
rebarLong , rebarShort , rebarStir)
return ivObj
if __name__=='__main__':
#Msg(crossSection(16))
covering = 25
#Msg(stirrupSpine(6, 200-covering*2, 400-covering*2))
dia=16
#Msg(get_UShape_Spine(A=500-100-16, B =1070-100-16 ,C=500-100-16 , R=3*dia) )
#Msg( get_LShape_Column_Spine(A=15*dia , B=750+450-dia ,R=3*dia) )
#Msg( get_UShape_Spine(A=15*dia , B=5500-dia, C=15*dia ,R=3*dia) )
F1=makePileCap_2Pile_IV()
F2=makePileCap_2Pile_IV(B=1000 , L = 500, t =300 ,
rebarLong=[12,7] ,rebarShort=[12,3] , rebarStir=[9])
F2.Placement.Base=Vector(2000,0,0)
F3=makePileCap_2Pile_IV(B=2000 , L = 5000, t =1000 ,
rebarLong=[20,20] ,rebarShort=[20,30] , rebarStir=[12])
F3.Placement.Base=Vector(5000,0,0)
#Msg(PileCap_2Pile_IV())
Msg('\n')
- Attachments
-
- RebarIV.py
- (9.58 KiB) Downloaded 59 times
Re: Make structural object in "App::InventorObject"
1) Rename python script file from "RebarIV.py" to "PadFootingIV.py"
2) Create dialog for input(more comfortable).
3) Three selection of end rebar(None , 90Hooks, 180Hooks).
2) Create dialog for input(more comfortable).
3) Three selection of end rebar(None , 90Hooks, 180Hooks).
- Attachments
-
- PadFootingIV.py
- (18.47 KiB) Downloaded 62 times
Re: Make structural object in "App::InventorObject"
Create Pad Footing in InventorObject with input dialog(using PySide2).
----------------------
Feature:
- input size of concrete footing (B, L,t) and set transparency.
- assign covering of rebars. [Top, Bottom, Side(use same 4 sides)]
- assign number, dia, and color of 3 types' rebar. [Primary rebar, Secondary rebar, and Lacer rebar]
Next step:
- create SVG rebar' schedule to TechDraw.
- maybe export a 2D drawing to dxf.(install ezdxf before)
----------------------
Feature:
- input size of concrete footing (B, L,t) and set transparency.
- assign covering of rebars. [Top, Bottom, Side(use same 4 sides)]
- assign number, dia, and color of 3 types' rebar. [Primary rebar, Secondary rebar, and Lacer rebar]
Next step:
- create SVG rebar' schedule to TechDraw.
- maybe export a 2D drawing to dxf.(install ezdxf before)
- Attachments
-
- PadFootingIV.py
- (30.16 KiB) Downloaded 63 times