-- $(
-- Author : Aurelio Peros Hinampas
-- Created : July 14, 2015
-- Email :
[email protected] -- Purpose : Create Structural Floor Grating.
-- Module : DESIGN
-- $)
setup form !!createGrating dialog dock
!this.formtitle = 'Create Structural Grating'
!this.cancelcall = '!this.dismiss()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
this.aidGratingBox()' width 7.5 is REAL format !!distanceFmt
text .yLength 'Y-Length' tagwidth 9 anchor
top+left+right callback '!this.aidGratingBox()' width 8 is
REAL format !!distanceFmt
line .barLenth anchor top+right vertical height 1
button .pickDimensions anchor top+right callback '!
this.pickDimensions()' pixmap height 16 width 16
button .interChange anchor top+right callback '!
this.interChange()' pixmap height 20 width 20
exit
path down
frame .plateframe 'Plate / Bar Dimensions' at
xmin.lengthframe anchor top+left+right width.lengthframe
text .plHeight 'Plate Height' tagwidth 9 callback '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
path right
text .plThick 'Plate Thick' tagwidth 8 width 5 is REAL
format !!boreFmt
text .rBarDia 'R-Bar Dia.' anchor top+left+right
tagwidth 8 width 5 is REAL format !!boreFmt
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
text .pitchXdir 'Pitch X-Direction' tagwidth 12 width
9 is REAL format !!distanceFmt
path right
text .pitchYdir 'Pitch Y-Direction' anchor
top+left+right tagwidth 12 width 9.25 is REAL format !!
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
width.lengthframe height 4
text .gratingPos 'Position' tagwidth 9 callback '!
this.aidGratingBox()' anchor top+left+right width 31.5 is
POSITION
path right
button .pickPosition callback '!this.pickPosition()'
anchor top+right pixmap height 16 width 16
path down
1
text .orientation 'Orientation' at xmin.gratingPos
anchor top+left+right tagwidth 9 callback '!this.aidGratingBox
()' width 35 is ORIENTATION
exit
button .create 'Create' at xmin.lengthframe anchor
bottom+left callback '!this.create()' linklabel
path right
button .about '?' at xmax form-size anchor bottom+right
linklabel callback '$P <$!<this>> 2015 - Aurelio Peros
Hinampas'
member .packet is EDGPACKET
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
exit
define method .createGrating()
!this.pickDimensions.setTooltip('Pick Dimensions for X-
Length & Y-Length by EDG measure.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
!this.interChange.addPixmap(!!pml.getpathname
('rotsup.png'))
!this.interChange.setTooltip('Swap X-Length & Y-Length
Dimensions.')
!this.pickPosition.addPixmap(!!pml.getpathname
('xyz16.png'))
!this.pickPosition.setTooltip('Set Origin of Structural
Grating by EDG Graphical Pick.')
!this.create.setTooltip('Create Structural Grating.')
!this.about.setTooltip('2015 - Aurelio Peros Hinampas')
!this.aidNumGrating = !!aidNumbers.add('Grating Aid
Number')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
!this.rBarDia.val = 10
!this.pitchXdir.val = 40
!this.pitchYdir.val = 200
!this.gratingPos.val = object POSITION('E0 N0 U0')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
define method .interChange()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
-- Swap Dimensions
!this.xLength.val = !yLen
!this.yLength.val = !xLen
!this.aidGratingBox()
2
endmethod
define method .pickDimensions()
-- Clear Pick Position Array
!this.pickPosi.clear()
AID CLEAR ALL $!<this.aidNumGrating>
!this.packet.definePosition('Pick Dimensions for X-Length
& Y-Length.')
!this.packet.description = 'X-Length & Y-Length'
!this.packet.action = '!!
createGrating.pickDimensionsDone(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .pickDimensionsDone(!pickedData is
EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
-- Saved Picked Position to an Array
!this.pickPosi.append(!this.position)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
$!<this.pickPosi[1]>
if (!this.pickPosi.size().eq(2)) then
!!edgCntrl.remove(!this.packetDesc)
-- X-Length Dimension
!xLength = !this.pickPosi[1].east - !this.pickPosi
[2].east
!this.xLength.val = !xLength.abs()
-- Y-Length Dimension
!yLength = !this.pickPosi[1].north - !this.pickPosi
[2].north
!this.yLength.val = !yLength.abs()
-- Update Grating Origin
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
!midPosi.north = !this.pickPosi[2].north
-- Construct Y-Line to get Direction
!yLine = object LINE(!this.pickPosi[1], !midPosi)
-- Construct X-Line to get Direction
!xLine = object LINE(!midPosi, !this.pickPosi[2])
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
!this.orientation.val = Y is $!<yDire> and X is $!
<xDire>
!this.aidGratingBox()
endif
endmethod
define method .pickPosition()
3
!this.packet.definePosition('Pick Origin of Structural
Grating.')
!this.packet.description = 'Reference Point'
!this.packet.action = '!!createGrating.positionDone
(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .positionDone(!pickedData is EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
!!edgCntrl.remove(!this.packetDesc)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
define method .aidGratingBox()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
!zLen = !this.plHeight.val
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
!zDir = !this.orientation.val.zDir()
if (!zDir.string().split()[1].upcase().eq('U')) then
!zOri = !zDir
else
!zOri = !zDir.opposite()
endif
!boxPos = !this.gratingPos.val.offset(!xDir,!xLen /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
-- Aid Box
AID CLEAR ALL $!<this.aidNumGrating>
AID TRANSLUCENCY 25
AID BOX NUMBER $!<this.aidNumGrating> AT $!<boxPos>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
AID TEXT NUMBER $!<this.aidNumGrating> 'Origin' AT $!
<this.gratingPos.val>
endmethod
define method .create()
!xCopies = (!this.xLength.val - !this.plThick.val) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
if (!!ce.type.eq('FRMW')) then
!frmwOwner = !!ce
else
!frmwOwner = !!dtbGetOwnerType(!!ce,'FRMW')
endif
if (!frmwOwner.unset()) then
return error 1 'Unable to find FRMW type for Grating
4
to be created with. Must create a FRMW first or CE must be in
or below FRMW.'
endif
if (!frmwOwner.isnamed) then
!ownerName = !frmwOwner.name
else
!ownerName = '/STRUCTURAL'
endif
do !num
if (!num.lt(10)) then
!sbfrName = !ownerName & '-GR-0' & !num
else
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
!!ce = !sbfrName.dbref()
enddo
-- Enable Undo
!undoAble = object UNDOABLE()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
!xDir = !this.orientation.val.xdir()
!yDir = !this.orientation.val.ydir()
!zDir = !this.orientation.val.zdir()
if (!zDir.string().split()[1].upcase().eq('D')) then
!sJus = 'UTOP'
!zOri = !zDir.opposite()
else
!sJus = 'UBOT'
!zOri = !zDir
endif
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
NEW PAVE
POSITION E 0 N ($!<this.yLength.val> - $!
<this.plThick.val>) U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.plThick.val> N ($!
<this.yLength.val> - $!<this.plThick.val>) U 0
5
END
-- <4>
NEW PAVE
POSITION E $!<this.plThick.val> N $!
<this.plThick.val> U 0
END
END
END
!!ce = !paneRefe
-- Copy Pane Along X-Direction
do !c from 1 to !xCopies.int()
skip if (!c.eq(!xCopies.int()) and !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
enddo
NEW PANE COPY $!<paneRefe> BY X ($!<this.xLength.val>
- $!<this.plThick.val>) WRT CE
-- End Plate 1
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N 0 U 0
END
-- <2>
NEW PAVE
POSITION E $!<this.xLength.val> N 0 U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
-- <4>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
END
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
-- Bar Section
!spref = '/DESPAR-SPEC/Tube_with_design_parameters'
!possOffset = !this.gratingPos.val.offset(!yDir,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
this.rBarDia.val / 2))
!poseOffset = !possOffset.offset(!xDir,!
6
this.xLength.val)
NEW SCTN
!sctnRefe = !!ce
SPREF $!<spref>
DESP $!<this.rBarDia.val> ($!<this.rBarDia.val> /
2)
JUS NA
POSS $!<possOffset>
POSE $!<poseOffset>
DRNS PERP
DRNE PERP
END
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
enddo
if ((!yRemainder.real() * !this.pitchYdir.val) gt 10)
then
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
endif
END
-- Terminate Undo
!undoAble.endundoable()
AID CLEAR ALL $!<this.aidNumGrating>
endmethod
define method .dismiss()
AID CLEAR ALL $!<this.aidNumGrating>
!this.hide()
endmethodsetup form !!createGrating dialog dock
!this.formtitle = 'Create Structural Grating'
!this.cancelcall = '!this.dismiss()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
this.aidGratingBox()' width 7.5 is REAL format !!distanceFmt
text .yLength 'Y-Length' tagwidth 9 anchor
top+left+right callback '!this.aidGratingBox()' width 8 is
REAL format !!distanceFmt
line .barLenth anchor top+right vertical height 1
button .pickDimensions anchor top+right callback '!
this.pickDimensions()' pixmap height 16 width 16
button .interChange anchor top+right callback '!
this.interChange()' pixmap height 20 width 20
exit
path down
frame .plateframe 'Plate / Bar Dimensions' at
xmin.lengthframe anchor top+left+right width.lengthframe
text .plHeight 'Plate Height' tagwidth 9 callback '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
path right
text .plThick 'Plate Thick' tagwidth 8 width 5 is REAL
7
format !!boreFmt
text .rBarDia 'R-Bar Dia.' anchor top+left+right
tagwidth 8 width 5 is REAL format !!boreFmt
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
text .pitchXdir 'Pitch X-Direction' tagwidth 12 width
9 is REAL format !!distanceFmt
path right
text .pitchYdir 'Pitch Y-Direction' anchor
top+left+right tagwidth 12 width 9.25 is REAL format !!
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
width.lengthframe height 4
text .gratingPos 'Position' tagwidth 9 callback '!
this.aidGratingBox()' anchor top+left+right width 31.5 is
POSITION
path right
button .pickPosition callback '!this.pickPosition()'
anchor top+right pixmap height 16 width 16
path down
text .orientation 'Orientation' at xmin.gratingPos
anchor top+left+right tagwidth 9 callback '!this.aidGratingBox
()' width 35 is ORIENTATION
exit
button .create 'Create' at xmin.lengthframe anchor
bottom+left callback '!this.create()' linklabel
path right
button .about '?' at xmax form-size anchor bottom+right
linklabel callback '$P <$!<this>> 2015 - Aurelio Peros
Hinampas'
member .packet is EDGPACKET
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
exit
define method .createGrating()
!this.pickDimensions.setTooltip('Pick Dimensions for X-
Length & Y-Length by EDG measure.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
!this.interChange.addPixmap(!!pml.getpathname
('rotsup.png'))
!this.interChange.setTooltip('Swap X-Length & Y-Length
Dimensions.')
!this.pickPosition.addPixmap(!!pml.getpathname
('xyz16.png'))
!this.pickPosition.setTooltip('Set Origin of Structural
Grating by EDG Graphical Pick.')
!this.create.setTooltip('Create Structural Grating.')
!this.about.setTooltip('2015 - Aurelio Peros Hinampas')
8
!this.aidNumGrating = !!aidNumbers.add('Grating Aid
Number')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
!this.rBarDia.val = 10
!this.pitchXdir.val = 40
!this.pitchYdir.val = 200
!this.gratingPos.val = object POSITION('E0 N0 U0')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
define method .interChange()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
-- Swap Dimensions
!this.xLength.val = !yLen
!this.yLength.val = !xLen
!this.aidGratingBox()
endmethod
define method .pickDimensions()
-- Clear Pick Position Array
!this.pickPosi.clear()
AID CLEAR ALL $!<this.aidNumGrating>
!this.packet.definePosition('Pick Dimensions for X-Length
& Y-Length.')
!this.packet.description = 'X-Length & Y-Length'
!this.packet.action = '!!
createGrating.pickDimensionsDone(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .pickDimensionsDone(!pickedData is
EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
-- Saved Picked Position to an Array
!this.pickPosi.append(!this.position)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
$!<this.pickPosi[1]>
if (!this.pickPosi.size().eq(2)) then
!!edgCntrl.remove(!this.packetDesc)
-- X-Length Dimension
!xLength = !this.pickPosi[1].east - !this.pickPosi
[2].east
!this.xLength.val = !xLength.abs()
-- Y-Length Dimension
!yLength = !this.pickPosi[1].north - !this.pickPosi
[2].north
9
!this.yLength.val = !yLength.abs()
-- Update Grating Origin
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
!midPosi.north = !this.pickPosi[2].north
-- Construct Y-Line to get Direction
!yLine = object LINE(!this.pickPosi[1], !midPosi)
-- Construct X-Line to get Direction
!xLine = object LINE(!midPosi, !this.pickPosi[2])
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
!this.orientation.val = Y is $!<yDire> and X is $!
<xDire>
!this.aidGratingBox()
endif
endmethod
define method .pickPosition()
!this.packet.definePosition('Pick Origin of Structural
Grating.')
!this.packet.description = 'Reference Point'
!this.packet.action = '!!createGrating.positionDone
(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .positionDone(!pickedData is EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
!!edgCntrl.remove(!this.packetDesc)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
define method .aidGratingBox()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
!zLen = !this.plHeight.val
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
!zDir = !this.orientation.val.zDir()
if (!zDir.string().split()[1].upcase().eq('U')) then
!zOri = !zDir
else
!zOri = !zDir.opposite()
endif
!boxPos = !this.gratingPos.val.offset(!xDir,!xLen /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
-- Aid Box
10
AID CLEAR ALL $!<this.aidNumGrating>
AID TRANSLUCENCY 25
AID BOX NUMBER $!<this.aidNumGrating> AT $!<boxPos>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
AID TEXT NUMBER $!<this.aidNumGrating> 'Origin' AT $!
<this.gratingPos.val>
endmethod
define method .create()
!xCopies = (!this.xLength.val - !this.plThick.val) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
if (!!ce.type.eq('FRMW')) then
!frmwOwner = !!ce
else
!frmwOwner = !!dtbGetOwnerType(!!ce,'FRMW')
endif
if (!frmwOwner.unset()) then
return error 1 'Unable to find FRMW type for Grating
to be created with. Must create a FRMW first or CE must be in
or below FRMW.'
endif
if (!frmwOwner.isnamed) then
!ownerName = !frmwOwner.name
else
!ownerName = '/STRUCTURAL'
endif
do !num
if (!num.lt(10)) then
!sbfrName = !ownerName & '-GR-0' & !num
else
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
!!ce = !sbfrName.dbref()
enddo
-- Enable Undo
!undoAble = object UNDOABLE()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
!xDir = !this.orientation.val.xdir()
!yDir = !this.orientation.val.ydir()
!zDir = !this.orientation.val.zdir()
if (!zDir.string().split()[1].upcase().eq('D')) then
!sJus = 'UTOP'
!zOri = !zDir.opposite()
else
!sJus = 'UBOT'
11
!zOri = !zDir
endif
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
NEW PAVE
POSITION E 0 N ($!<this.yLength.val> - $!
<this.plThick.val>) U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.plThick.val> N ($!
<this.yLength.val> - $!<this.plThick.val>) U 0
END
-- <4>
NEW PAVE
POSITION E $!<this.plThick.val> N $!
<this.plThick.val> U 0
END
END
END
!!ce = !paneRefe
-- Copy Pane Along X-Direction
do !c from 1 to !xCopies.int()
skip if (!c.eq(!xCopies.int()) and !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
enddo
NEW PANE COPY $!<paneRefe> BY X ($!<this.xLength.val>
- $!<this.plThick.val>) WRT CE
-- End Plate 1
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N 0 U 0
END
-- <2>
NEW PAVE
12
POSITION E $!<this.xLength.val> N 0 U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
-- <4>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
END
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
-- Bar Section
!spref = '/DESPAR-SPEC/Tube_with_design_parameters'
!possOffset = !this.gratingPos.val.offset(!yDir,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
this.rBarDia.val / 2))
!poseOffset = !possOffset.offset(!xDir,!
this.xLength.val)
NEW SCTN
!sctnRefe = !!ce
SPREF $!<spref>
DESP $!<this.rBarDia.val> ($!<this.rBarDia.val> /
2)
JUS NA
POSS $!<possOffset>
POSE $!<poseOffset>
DRNS PERP
DRNE PERP
END
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
enddo
if ((!yRemainder.real() * !this.pitchYdir.val) gt 10)
then
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
endif
END
-- Terminate Undo
!undoAble.endundoable()
AID CLEAR ALL $!<this.aidNumGrating>
endmethod
define method .dismiss()
AID CLEAR ALL $!<this.aidNumGrating>
!this.hide()
13
endmethodsetup form !!createGrating dialog dock
!this.formtitle = 'Create Structural Grating'
!this.cancelcall = '!this.dismiss()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
this.aidGratingBox()' width 7.5 is REAL format !!distanceFmt
text .yLength 'Y-Length' tagwidth 9 anchor
top+left+right callback '!this.aidGratingBox()' width 8 is
REAL format !!distanceFmt
line .barLenth anchor top+right vertical height 1
button .pickDimensions anchor top+right callback '!
this.pickDimensions()' pixmap height 16 width 16
button .interChange anchor top+right callback '!
this.interChange()' pixmap height 20 width 20
exit
path down
frame .plateframe 'Plate / Bar Dimensions' at
xmin.lengthframe anchor top+left+right width.lengthframe
text .plHeight 'Plate Height' tagwidth 9 callback '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
path right
text .plThick 'Plate Thick' tagwidth 8 width 5 is REAL
format !!boreFmt
text .rBarDia 'R-Bar Dia.' anchor top+left+right
tagwidth 8 width 5 is REAL format !!boreFmt
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
text .pitchXdir 'Pitch X-Direction' tagwidth 12 width
9 is REAL format !!distanceFmt
path right
text .pitchYdir 'Pitch Y-Direction' anchor
top+left+right tagwidth 12 width 9.25 is REAL format !!
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
width.lengthframe height 4
text .gratingPos 'Position' tagwidth 9 callback '!
this.aidGratingBox()' anchor top+left+right width 31.5 is
POSITION
path right
button .pickPosition callback '!this.pickPosition()'
anchor top+right pixmap height 16 width 16
path down
text .orientation 'Orientation' at xmin.gratingPos
anchor top+left+right tagwidth 9 callback '!this.aidGratingBox
()' width 35 is ORIENTATION
exit
button .create 'Create' at xmin.lengthframe anchor
bottom+left callback '!this.create()' linklabel
path right
button .about '?' at xmax form-size anchor bottom+right
linklabel callback '$P <$!<this>> 2015 - Aurelio Peros
14
Hinampas'
member .packet is EDGPACKET
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
exit
define method .createGrating()
!this.pickDimensions.setTooltip('Pick Dimensions for X-
Length & Y-Length by EDG measure.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
!this.interChange.addPixmap(!!pml.getpathname
('rotsup.png'))
!this.interChange.setTooltip('Swap X-Length & Y-Length
Dimensions.')
!this.pickPosition.addPixmap(!!pml.getpathname
('xyz16.png'))
!this.pickPosition.setTooltip('Set Origin of Structural
Grating by EDG Graphical Pick.')
!this.create.setTooltip('Create Structural Grating.')
!this.about.setTooltip('2015 - Aurelio Peros Hinampas')
!this.aidNumGrating = !!aidNumbers.add('Grating Aid
Number')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
!this.rBarDia.val = 10
!this.pitchXdir.val = 40
!this.pitchYdir.val = 200
!this.gratingPos.val = object POSITION('E0 N0 U0')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
define method .interChange()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
-- Swap Dimensions
!this.xLength.val = !yLen
!this.yLength.val = !xLen
!this.aidGratingBox()
endmethod
define method .pickDimensions()
-- Clear Pick Position Array
!this.pickPosi.clear()
AID CLEAR ALL $!<this.aidNumGrating>
!this.packet.definePosition('Pick Dimensions for X-Length
& Y-Length.')
15
!this.packet.description = 'X-Length & Y-Length'
!this.packet.action = '!!
createGrating.pickDimensionsDone(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .pickDimensionsDone(!pickedData is
EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
-- Saved Picked Position to an Array
!this.pickPosi.append(!this.position)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
$!<this.pickPosi[1]>
if (!this.pickPosi.size().eq(2)) then
!!edgCntrl.remove(!this.packetDesc)
-- X-Length Dimension
!xLength = !this.pickPosi[1].east - !this.pickPosi
[2].east
!this.xLength.val = !xLength.abs()
-- Y-Length Dimension
!yLength = !this.pickPosi[1].north - !this.pickPosi
[2].north
!this.yLength.val = !yLength.abs()
-- Update Grating Origin
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
!midPosi.north = !this.pickPosi[2].north
-- Construct Y-Line to get Direction
!yLine = object LINE(!this.pickPosi[1], !midPosi)
-- Construct X-Line to get Direction
!xLine = object LINE(!midPosi, !this.pickPosi[2])
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
!this.orientation.val = Y is $!<yDire> and X is $!
<xDire>
!this.aidGratingBox()
endif
endmethod
define method .pickPosition()
!this.packet.definePosition('Pick Origin of Structural
Grating.')
!this.packet.description = 'Reference Point'
!this.packet.action = '!!createGrating.positionDone
(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
16
define method .positionDone(!pickedData is EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
!!edgCntrl.remove(!this.packetDesc)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
define method .aidGratingBox()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
!zLen = !this.plHeight.val
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
!zDir = !this.orientation.val.zDir()
if (!zDir.string().split()[1].upcase().eq('U')) then
!zOri = !zDir
else
!zOri = !zDir.opposite()
endif
!boxPos = !this.gratingPos.val.offset(!xDir,!xLen /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
-- Aid Box
AID CLEAR ALL $!<this.aidNumGrating>
AID TRANSLUCENCY 25
AID BOX NUMBER $!<this.aidNumGrating> AT $!<boxPos>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
AID TEXT NUMBER $!<this.aidNumGrating> 'Origin' AT $!
<this.gratingPos.val>
endmethod
define method .create()
!xCopies = (!this.xLength.val - !this.plThick.val) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
if (!!ce.type.eq('FRMW')) then
!frmwOwner = !!ce
else
!frmwOwner = !!dtbGetOwnerType(!!ce,'FRMW')
endif
if (!frmwOwner.unset()) then
return error 1 'Unable to find FRMW type for Grating
to be created with. Must create a FRMW first or CE must be in
or below FRMW.'
endif
if (!frmwOwner.isnamed) then
!ownerName = !frmwOwner.name
else
!ownerName = '/STRUCTURAL'
endif
do !num
17
if (!num.lt(10)) then
!sbfrName = !ownerName & '-GR-0' & !num
else
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
!!ce = !sbfrName.dbref()
enddo
-- Enable Undo
!undoAble = object UNDOABLE()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
!xDir = !this.orientation.val.xdir()
!yDir = !this.orientation.val.ydir()
!zDir = !this.orientation.val.zdir()
if (!zDir.string().split()[1].upcase().eq('D')) then
!sJus = 'UTOP'
!zOri = !zDir.opposite()
else
!sJus = 'UBOT'
!zOri = !zDir
endif
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
NEW PAVE
POSITION E 0 N ($!<this.yLength.val> - $!
<this.plThick.val>) U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.plThick.val> N ($!
<this.yLength.val> - $!<this.plThick.val>) U 0
END
-- <4>
NEW PAVE
POSITION E $!<this.plThick.val> N $!
<this.plThick.val> U 0
END
END
END
!!ce = !paneRefe
18
-- Copy Pane Along X-Direction
do !c from 1 to !xCopies.int()
skip if (!c.eq(!xCopies.int()) and !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
enddo
NEW PANE COPY $!<paneRefe> BY X ($!<this.xLength.val>
- $!<this.plThick.val>) WRT CE
-- End Plate 1
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N 0 U 0
END
-- <2>
NEW PAVE
POSITION E $!<this.xLength.val> N 0 U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
-- <4>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
END
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
-- Bar Section
!spref = '/DESPAR-SPEC/Tube_with_design_parameters'
!possOffset = !this.gratingPos.val.offset(!yDir,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
this.rBarDia.val / 2))
!poseOffset = !possOffset.offset(!xDir,!
this.xLength.val)
NEW SCTN
!sctnRefe = !!ce
SPREF $!<spref>
DESP $!<this.rBarDia.val> ($!<this.rBarDia.val> /
2)
JUS NA
POSS $!<possOffset>
POSE $!<poseOffset>
19
DRNS PERP
DRNE PERP
END
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
enddo
if ((!yRemainder.real() * !this.pitchYdir.val) gt 10)
then
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
endif
END
-- Terminate Undo
!undoAble.endundoable()
AID CLEAR ALL $!<this.aidNumGrating>
endmethod
define method .dismiss()
AID CLEAR ALL $!<this.aidNumGrating>
!this.hide()
endmethodsetup form !!createGrating dialog dock
!this.formtitle = 'Create Structural Grating'
!this.cancelcall = '!this.dismiss()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
this.aidGratingBox()' width 7.5 is REAL format !!distanceFmt
text .yLength 'Y-Length' tagwidth 9 anchor
top+left+right callback '!this.aidGratingBox()' width 8 is
REAL format !!distanceFmt
line .barLenth anchor top+right vertical height 1
button .pickDimensions anchor top+right callback '!
this.pickDimensions()' pixmap height 16 width 16
button .interChange anchor top+right callback '!
this.interChange()' pixmap height 20 width 20
exit
path down
frame .plateframe 'Plate / Bar Dimensions' at
xmin.lengthframe anchor top+left+right width.lengthframe
text .plHeight 'Plate Height' tagwidth 9 callback '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
path right
text .plThick 'Plate Thick' tagwidth 8 width 5 is REAL
format !!boreFmt
text .rBarDia 'R-Bar Dia.' anchor top+left+right
tagwidth 8 width 5 is REAL format !!boreFmt
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
text .pitchXdir 'Pitch X-Direction' tagwidth 12 width
9 is REAL format !!distanceFmt
20
path right
text .pitchYdir 'Pitch Y-Direction' anchor
top+left+right tagwidth 12 width 9.25 is REAL format !!
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
width.lengthframe height 4
text .gratingPos 'Position' tagwidth 9 callback '!
this.aidGratingBox()' anchor top+left+right width 31.5 is
POSITION
path right
button .pickPosition callback '!this.pickPosition()'
anchor top+right pixmap height 16 width 16
path down
text .orientation 'Orientation' at xmin.gratingPos
anchor top+left+right tagwidth 9 callback '!this.aidGratingBox
()' width 35 is ORIENTATION
exit
button .create 'Create' at xmin.lengthframe anchor
bottom+left callback '!this.create()' linklabel
path right
button .about '?' at xmax form-size anchor bottom+right
linklabel callback '$P <$!<this>> 2015 - Aurelio Peros
Hinampas'
member .packet is EDGPACKET
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
exit
define method .createGrating()
!this.pickDimensions.setTooltip('Pick Dimensions for X-
Length & Y-Length by EDG measure.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
!this.interChange.addPixmap(!!pml.getpathname
('rotsup.png'))
!this.interChange.setTooltip('Swap X-Length & Y-Length
Dimensions.')
!this.pickPosition.addPixmap(!!pml.getpathname
('xyz16.png'))
!this.pickPosition.setTooltip('Set Origin of Structural
Grating by EDG Graphical Pick.')
!this.create.setTooltip('Create Structural Grating.')
!this.about.setTooltip('2015 - Aurelio Peros Hinampas')
!this.aidNumGrating = !!aidNumbers.add('Grating Aid
Number')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
!this.rBarDia.val = 10
!this.pitchXdir.val = 40
21
!this.pitchYdir.val = 200
!this.gratingPos.val = object POSITION('E0 N0 U0')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
define method .interChange()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
-- Swap Dimensions
!this.xLength.val = !yLen
!this.yLength.val = !xLen
!this.aidGratingBox()
endmethod
define method .pickDimensions()
-- Clear Pick Position Array
!this.pickPosi.clear()
AID CLEAR ALL $!<this.aidNumGrating>
!this.packet.definePosition('Pick Dimensions for X-Length
& Y-Length.')
!this.packet.description = 'X-Length & Y-Length'
!this.packet.action = '!!
createGrating.pickDimensionsDone(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .pickDimensionsDone(!pickedData is
EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
-- Saved Picked Position to an Array
!this.pickPosi.append(!this.position)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
$!<this.pickPosi[1]>
if (!this.pickPosi.size().eq(2)) then
!!edgCntrl.remove(!this.packetDesc)
-- X-Length Dimension
!xLength = !this.pickPosi[1].east - !this.pickPosi
[2].east
!this.xLength.val = !xLength.abs()
-- Y-Length Dimension
!yLength = !this.pickPosi[1].north - !this.pickPosi
[2].north
!this.yLength.val = !yLength.abs()
-- Update Grating Origin
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
!midPosi.north = !this.pickPosi[2].north
-- Construct Y-Line to get Direction
22
!yLine = object LINE(!this.pickPosi[1], !midPosi)
-- Construct X-Line to get Direction
!xLine = object LINE(!midPosi, !this.pickPosi[2])
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
!this.orientation.val = Y is $!<yDire> and X is $!
<xDire>
!this.aidGratingBox()
endif
endmethod
define method .pickPosition()
!this.packet.definePosition('Pick Origin of Structural
Grating.')
!this.packet.description = 'Reference Point'
!this.packet.action = '!!createGrating.positionDone
(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .positionDone(!pickedData is EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
!!edgCntrl.remove(!this.packetDesc)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
define method .aidGratingBox()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
!zLen = !this.plHeight.val
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
!zDir = !this.orientation.val.zDir()
if (!zDir.string().split()[1].upcase().eq('U')) then
!zOri = !zDir
else
!zOri = !zDir.opposite()
endif
!boxPos = !this.gratingPos.val.offset(!xDir,!xLen /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
-- Aid Box
AID CLEAR ALL $!<this.aidNumGrating>
AID TRANSLUCENCY 25
AID BOX NUMBER $!<this.aidNumGrating> AT $!<boxPos>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
AID TEXT NUMBER $!<this.aidNumGrating> 'Origin' AT $!
<this.gratingPos.val>
endmethod
23
define method .create()
!xCopies = (!this.xLength.val - !this.plThick.val) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
if (!!ce.type.eq('FRMW')) then
!frmwOwner = !!ce
else
!frmwOwner = !!dtbGetOwnerType(!!ce,'FRMW')
endif
if (!frmwOwner.unset()) then
return error 1 'Unable to find FRMW type for Grating
to be created with. Must create a FRMW first or CE must be in
or below FRMW.'
endif
if (!frmwOwner.isnamed) then
!ownerName = !frmwOwner.name
else
!ownerName = '/STRUCTURAL'
endif
do !num
if (!num.lt(10)) then
!sbfrName = !ownerName & '-GR-0' & !num
else
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
!!ce = !sbfrName.dbref()
enddo
-- Enable Undo
!undoAble = object UNDOABLE()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
!xDir = !this.orientation.val.xdir()
!yDir = !this.orientation.val.ydir()
!zDir = !this.orientation.val.zdir()
if (!zDir.string().split()[1].upcase().eq('D')) then
!sJus = 'UTOP'
!zOri = !zDir.opposite()
else
!sJus = 'UBOT'
!zOri = !zDir
endif
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
24
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
NEW PAVE
POSITION E 0 N ($!<this.yLength.val> - $!
<this.plThick.val>) U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.plThick.val> N ($!
<this.yLength.val> - $!<this.plThick.val>) U 0
END
-- <4>
NEW PAVE
POSITION E $!<this.plThick.val> N $!
<this.plThick.val> U 0
END
END
END
!!ce = !paneRefe
-- Copy Pane Along X-Direction
do !c from 1 to !xCopies.int()
skip if (!c.eq(!xCopies.int()) and !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
enddo
NEW PANE COPY $!<paneRefe> BY X ($!<this.xLength.val>
- $!<this.plThick.val>) WRT CE
-- End Plate 1
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N 0 U 0
END
-- <2>
NEW PAVE
POSITION E $!<this.xLength.val> N 0 U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
-- <4>
NEW PAVE
25
POSITION E 0 N $!<this.plThick.val> U 0
END
END
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
-- Bar Section
!spref = '/DESPAR-SPEC/Tube_with_design_parameters'
!possOffset = !this.gratingPos.val.offset(!yDir,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
this.rBarDia.val / 2))
!poseOffset = !possOffset.offset(!xDir,!
this.xLength.val)
NEW SCTN
!sctnRefe = !!ce
SPREF $!<spref>
DESP $!<this.rBarDia.val> ($!<this.rBarDia.val> /
2)
JUS NA
POSS $!<possOffset>
POSE $!<poseOffset>
DRNS PERP
DRNE PERP
END
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
enddo
if ((!yRemainder.real() * !this.pitchYdir.val) gt 10)
then
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
endif
END
-- Terminate Undo
!undoAble.endundoable()
AID CLEAR ALL $!<this.aidNumGrating>
endmethod
define method .dismiss()
AID CLEAR ALL $!<this.aidNumGrating>
!this.hide()
endmethodsetup form !!createGrating dialog dock
!this.formtitle = 'Create Structural Grating'
!this.cancelcall = '!this.dismiss()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
this.aidGratingBox()' width 7.5 is REAL format !!distanceFmt
text .yLength 'Y-Length' tagwidth 9 anchor
26
top+left+right callback '!this.aidGratingBox()' width 8 is
REAL format !!distanceFmt
line .barLenth anchor top+right vertical height 1
button .pickDimensions anchor top+right callback '!
this.pickDimensions()' pixmap height 16 width 16
button .interChange anchor top+right callback '!
this.interChange()' pixmap height 20 width 20
exit
path down
frame .plateframe 'Plate / Bar Dimensions' at
xmin.lengthframe anchor top+left+right width.lengthframe
text .plHeight 'Plate Height' tagwidth 9 callback '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
path right
text .plThick 'Plate Thick' tagwidth 8 width 5 is REAL
format !!boreFmt
text .rBarDia 'R-Bar Dia.' anchor top+left+right
tagwidth 8 width 5 is REAL format !!boreFmt
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
text .pitchXdir 'Pitch X-Direction' tagwidth 12 width
9 is REAL format !!distanceFmt
path right
text .pitchYdir 'Pitch Y-Direction' anchor
top+left+right tagwidth 12 width 9.25 is REAL format !!
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
width.lengthframe height 4
text .gratingPos 'Position' tagwidth 9 callback '!
this.aidGratingBox()' anchor top+left+right width 31.5 is
POSITION
path right
button .pickPosition callback '!this.pickPosition()'
anchor top+right pixmap height 16 width 16
path down
text .orientation 'Orientation' at xmin.gratingPos
anchor top+left+right tagwidth 9 callback '!this.aidGratingBox
()' width 35 is ORIENTATION
exit
button .create 'Create' at xmin.lengthframe anchor
bottom+left callback '!this.create()' linklabel
path right
button .about '?' at xmax form-size anchor bottom+right
linklabel callback '$P <$!<this>> 2015 - Aurelio Peros
Hinampas'
member .packet is EDGPACKET
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
exit
27
define method .createGrating()
!this.pickDimensions.setTooltip('Pick Dimensions for X-
Length & Y-Length by EDG measure.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
!this.interChange.addPixmap(!!pml.getpathname
('rotsup.png'))
!this.interChange.setTooltip('Swap X-Length & Y-Length
Dimensions.')
!this.pickPosition.addPixmap(!!pml.getpathname
('xyz16.png'))
!this.pickPosition.setTooltip('Set Origin of Structural
Grating by EDG Graphical Pick.')
!this.create.setTooltip('Create Structural Grating.')
!this.about.setTooltip('2015 - Aurelio Peros Hinampas')
!this.aidNumGrating = !!aidNumbers.add('Grating Aid
Number')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
!this.rBarDia.val = 10
!this.pitchXdir.val = 40
!this.pitchYdir.val = 200
!this.gratingPos.val = object POSITION('E0 N0 U0')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
define method .interChange()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
-- Swap Dimensions
!this.xLength.val = !yLen
!this.yLength.val = !xLen
!this.aidGratingBox()
endmethod
define method .pickDimensions()
-- Clear Pick Position Array
!this.pickPosi.clear()
AID CLEAR ALL $!<this.aidNumGrating>
!this.packet.definePosition('Pick Dimensions for X-Length
& Y-Length.')
!this.packet.description = 'X-Length & Y-Length'
!this.packet.action = '!!
createGrating.pickDimensionsDone(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .pickDimensionsDone(!pickedData is
EDGPOSITIONDATA)
28
!this.position.position('$!<pickedData.position>')
-- Saved Picked Position to an Array
!this.pickPosi.append(!this.position)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
$!<this.pickPosi[1]>
if (!this.pickPosi.size().eq(2)) then
!!edgCntrl.remove(!this.packetDesc)
-- X-Length Dimension
!xLength = !this.pickPosi[1].east - !this.pickPosi
[2].east
!this.xLength.val = !xLength.abs()
-- Y-Length Dimension
!yLength = !this.pickPosi[1].north - !this.pickPosi
[2].north
!this.yLength.val = !yLength.abs()
-- Update Grating Origin
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
!midPosi.north = !this.pickPosi[2].north
-- Construct Y-Line to get Direction
!yLine = object LINE(!this.pickPosi[1], !midPosi)
-- Construct X-Line to get Direction
!xLine = object LINE(!midPosi, !this.pickPosi[2])
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
!this.orientation.val = Y is $!<yDire> and X is $!
<xDire>
!this.aidGratingBox()
endif
endmethod
define method .pickPosition()
!this.packet.definePosition('Pick Origin of Structural
Grating.')
!this.packet.description = 'Reference Point'
!this.packet.action = '!!createGrating.positionDone
(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .positionDone(!pickedData is EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
!!edgCntrl.remove(!this.packetDesc)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
define method .aidGratingBox()
29
!xLen = !this.xLength.val
!yLen = !this.yLength.val
!zLen = !this.plHeight.val
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
!zDir = !this.orientation.val.zDir()
if (!zDir.string().split()[1].upcase().eq('U')) then
!zOri = !zDir
else
!zOri = !zDir.opposite()
endif
!boxPos = !this.gratingPos.val.offset(!xDir,!xLen /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
-- Aid Box
AID CLEAR ALL $!<this.aidNumGrating>
AID TRANSLUCENCY 25
AID BOX NUMBER $!<this.aidNumGrating> AT $!<boxPos>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
AID TEXT NUMBER $!<this.aidNumGrating> 'Origin' AT $!
<this.gratingPos.val>
endmethod
define method .create()
!xCopies = (!this.xLength.val - !this.plThick.val) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
if (!!ce.type.eq('FRMW')) then
!frmwOwner = !!ce
else
!frmwOwner = !!dtbGetOwnerType(!!ce,'FRMW')
endif
if (!frmwOwner.unset()) then
return error 1 'Unable to find FRMW type for Grating
to be created with. Must create a FRMW first or CE must be in
or below FRMW.'
endif
if (!frmwOwner.isnamed) then
!ownerName = !frmwOwner.name
else
!ownerName = '/STRUCTURAL'
endif
do !num
if (!num.lt(10)) then
!sbfrName = !ownerName & '-GR-0' & !num
else
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
!!ce = !sbfrName.dbref()
enddo
30
-- Enable Undo
!undoAble = object UNDOABLE()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
!xDir = !this.orientation.val.xdir()
!yDir = !this.orientation.val.ydir()
!zDir = !this.orientation.val.zdir()
if (!zDir.string().split()[1].upcase().eq('D')) then
!sJus = 'UTOP'
!zOri = !zDir.opposite()
else
!sJus = 'UBOT'
!zOri = !zDir
endif
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
NEW PAVE
POSITION E 0 N ($!<this.yLength.val> - $!
<this.plThick.val>) U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.plThick.val> N ($!
<this.yLength.val> - $!<this.plThick.val>) U 0
END
-- <4>
NEW PAVE
POSITION E $!<this.plThick.val> N $!
<this.plThick.val> U 0
END
END
END
!!ce = !paneRefe
-- Copy Pane Along X-Direction
do !c from 1 to !xCopies.int()
skip if (!c.eq(!xCopies.int()) and !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
enddo
NEW PANE COPY $!<paneRefe> BY X ($!<this.xLength.val>
- $!<this.plThick.val>) WRT CE
31
-- End Plate 1
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N 0 U 0
END
-- <2>
NEW PAVE
POSITION E $!<this.xLength.val> N 0 U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
-- <4>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
END
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
-- Bar Section
!spref = '/DESPAR-SPEC/Tube_with_design_parameters'
!possOffset = !this.gratingPos.val.offset(!yDir,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
this.rBarDia.val / 2))
!poseOffset = !possOffset.offset(!xDir,!
this.xLength.val)
NEW SCTN
!sctnRefe = !!ce
SPREF $!<spref>
DESP $!<this.rBarDia.val> ($!<this.rBarDia.val> /
2)
JUS NA
POSS $!<possOffset>
POSE $!<poseOffset>
DRNS PERP
DRNE PERP
END
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
enddo
if ((!yRemainder.real() * !this.pitchYdir.val) gt 10)
32
then
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
endif
END
-- Terminate Undo
!undoAble.endundoable()
AID CLEAR ALL $!<this.aidNumGrating>
endmethod
define method .dismiss()
AID CLEAR ALL $!<this.aidNumGrating>
!this.hide()
endmethodsetup form !!createGrating dialog dock
!this.formtitle = 'Create Structural Grating'
!this.cancelcall = '!this.dismiss()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
this.aidGratingBox()' width 7.5 is REAL format !!distanceFmt
text .yLength 'Y-Length' tagwidth 9 anchor
top+left+right callback '!this.aidGratingBox()' width 8 is
REAL format !!distanceFmt
line .barLenth anchor top+right vertical height 1
button .pickDimensions anchor top+right callback '!
this.pickDimensions()' pixmap height 16 width 16
button .interChange anchor top+right callback '!
this.interChange()' pixmap height 20 width 20
exit
path down
frame .plateframe 'Plate / Bar Dimensions' at
xmin.lengthframe anchor top+left+right width.lengthframe
text .plHeight 'Plate Height' tagwidth 9 callback '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
path right
text .plThick 'Plate Thick' tagwidth 8 width 5 is REAL
format !!boreFmt
text .rBarDia 'R-Bar Dia.' anchor top+left+right
tagwidth 8 width 5 is REAL format !!boreFmt
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
text .pitchXdir 'Pitch X-Direction' tagwidth 12 width
9 is REAL format !!distanceFmt
path right
text .pitchYdir 'Pitch Y-Direction' anchor
top+left+right tagwidth 12 width 9.25 is REAL format !!
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
width.lengthframe height 4
text .gratingPos 'Position' tagwidth 9 callback '!
33
this.aidGratingBox()' anchor top+left+right width 31.5 is
POSITION
path right
button .pickPosition callback '!this.pickPosition()'
anchor top+right pixmap height 16 width 16
path down
text .orientation 'Orientation' at xmin.gratingPos
anchor top+left+right tagwidth 9 callback '!this.aidGratingBox
()' width 35 is ORIENTATION
exit
button .create 'Create' at xmin.lengthframe anchor
bottom+left callback '!this.create()' linklabel
path right
button .about '?' at xmax form-size anchor bottom+right
linklabel callback '$P <$!<this>> 2015 - Aurelio Peros
Hinampas'
member .packet is EDGPACKET
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
exit
define method .createGrating()
!this.pickDimensions.setTooltip('Pick Dimensions for X-
Length & Y-Length by EDG measure.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
!this.interChange.addPixmap(!!pml.getpathname
('rotsup.png'))
!this.interChange.setTooltip('Swap X-Length & Y-Length
Dimensions.')
!this.pickPosition.addPixmap(!!pml.getpathname
('xyz16.png'))
!this.pickPosition.setTooltip('Set Origin of Structural
Grating by EDG Graphical Pick.')
!this.create.setTooltip('Create Structural Grating.')
!this.about.setTooltip('2015 - Aurelio Peros Hinampas')
!this.aidNumGrating = !!aidNumbers.add('Grating Aid
Number')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
!this.rBarDia.val = 10
!this.pitchXdir.val = 40
!this.pitchYdir.val = 200
!this.gratingPos.val = object POSITION('E0 N0 U0')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
define method .interChange()
!xLen = !this.xLength.val
34
!yLen = !this.yLength.val
-- Swap Dimensions
!this.xLength.val = !yLen
!this.yLength.val = !xLen
!this.aidGratingBox()
endmethod
define method .pickDimensions()
-- Clear Pick Position Array
!this.pickPosi.clear()
AID CLEAR ALL $!<this.aidNumGrating>
!this.packet.definePosition('Pick Dimensions for X-Length
& Y-Length.')
!this.packet.description = 'X-Length & Y-Length'
!this.packet.action = '!!
createGrating.pickDimensionsDone(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .pickDimensionsDone(!pickedData is
EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
-- Saved Picked Position to an Array
!this.pickPosi.append(!this.position)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
$!<this.pickPosi[1]>
if (!this.pickPosi.size().eq(2)) then
!!edgCntrl.remove(!this.packetDesc)
-- X-Length Dimension
!xLength = !this.pickPosi[1].east - !this.pickPosi
[2].east
!this.xLength.val = !xLength.abs()
-- Y-Length Dimension
!yLength = !this.pickPosi[1].north - !this.pickPosi
[2].north
!this.yLength.val = !yLength.abs()
-- Update Grating Origin
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
!midPosi.north = !this.pickPosi[2].north
-- Construct Y-Line to get Direction
!yLine = object LINE(!this.pickPosi[1], !midPosi)
-- Construct X-Line to get Direction
!xLine = object LINE(!midPosi, !this.pickPosi[2])
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
!this.orientation.val = Y is $!<yDire> and X is $!
<xDire>
35
!this.aidGratingBox()
endif
endmethod
define method .pickPosition()
!this.packet.definePosition('Pick Origin of Structural
Grating.')
!this.packet.description = 'Reference Point'
!this.packet.action = '!!createGrating.positionDone
(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .positionDone(!pickedData is EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
!!edgCntrl.remove(!this.packetDesc)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
define method .aidGratingBox()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
!zLen = !this.plHeight.val
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
!zDir = !this.orientation.val.zDir()
if (!zDir.string().split()[1].upcase().eq('U')) then
!zOri = !zDir
else
!zOri = !zDir.opposite()
endif
!boxPos = !this.gratingPos.val.offset(!xDir,!xLen /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
-- Aid Box
AID CLEAR ALL $!<this.aidNumGrating>
AID TRANSLUCENCY 25
AID BOX NUMBER $!<this.aidNumGrating> AT $!<boxPos>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
AID TEXT NUMBER $!<this.aidNumGrating> 'Origin' AT $!
<this.gratingPos.val>
endmethod
define method .create()
!xCopies = (!this.xLength.val - !this.plThick.val) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
if (!!ce.type.eq('FRMW')) then
36
!frmwOwner = !!ce
else
!frmwOwner = !!dtbGetOwnerType(!!ce,'FRMW')
endif
if (!frmwOwner.unset()) then
return error 1 'Unable to find FRMW type for Grating
to be created with. Must create a FRMW first or CE must be in
or below FRMW.'
endif
if (!frmwOwner.isnamed) then
!ownerName = !frmwOwner.name
else
!ownerName = '/STRUCTURAL'
endif
do !num
if (!num.lt(10)) then
!sbfrName = !ownerName & '-GR-0' & !num
else
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
!!ce = !sbfrName.dbref()
enddo
-- Enable Undo
!undoAble = object UNDOABLE()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
!xDir = !this.orientation.val.xdir()
!yDir = !this.orientation.val.ydir()
!zDir = !this.orientation.val.zdir()
if (!zDir.string().split()[1].upcase().eq('D')) then
!sJus = 'UTOP'
!zOri = !zDir.opposite()
else
!sJus = 'UBOT'
!zOri = !zDir
endif
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
NEW PAVE
POSITION E 0 N ($!<this.yLength.val> - $!
37
<this.plThick.val>) U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.plThick.val> N ($!
<this.yLength.val> - $!<this.plThick.val>) U 0
END
-- <4>
NEW PAVE
POSITION E $!<this.plThick.val> N $!
<this.plThick.val> U 0
END
END
END
!!ce = !paneRefe
-- Copy Pane Along X-Direction
do !c from 1 to !xCopies.int()
skip if (!c.eq(!xCopies.int()) and !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
enddo
NEW PANE COPY $!<paneRefe> BY X ($!<this.xLength.val>
- $!<this.plThick.val>) WRT CE
-- End Plate 1
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N 0 U 0
END
-- <2>
NEW PAVE
POSITION E $!<this.xLength.val> N 0 U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
-- <4>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
END
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
-- Bar Section
38
!spref = '/DESPAR-SPEC/Tube_with_design_parameters'
!possOffset = !this.gratingPos.val.offset(!yDir,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
this.rBarDia.val / 2))
!poseOffset = !possOffset.offset(!xDir,!
this.xLength.val)
NEW SCTN
!sctnRefe = !!ce
SPREF $!<spref>
DESP $!<this.rBarDia.val> ($!<this.rBarDia.val> /
2)
JUS NA
POSS $!<possOffset>
POSE $!<poseOffset>
DRNS PERP
DRNE PERP
END
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
enddo
if ((!yRemainder.real() * !this.pitchYdir.val) gt 10)
then
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
endif
END
-- Terminate Undo
!undoAble.endundoable()
AID CLEAR ALL $!<this.aidNumGrating>
endmethod
define method .dismiss()
AID CLEAR ALL $!<this.aidNumGrating>
!this.hide()
endmethodsetup form !!createGrating dialog dock
!this.formtitle = 'Create Structural Grating'
!this.cancelcall = '!this.dismiss()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
this.aidGratingBox()' width 7.5 is REAL format !!distanceFmt
text .yLength 'Y-Length' tagwidth 9 anchor
top+left+right callback '!this.aidGratingBox()' width 8 is
REAL format !!distanceFmt
line .barLenth anchor top+right vertical height 1
button .pickDimensions anchor top+right callback '!
this.pickDimensions()' pixmap height 16 width 16
button .interChange anchor top+right callback '!
this.interChange()' pixmap height 20 width 20
exit
path down
39
frame .plateframe 'Plate / Bar Dimensions' at
xmin.lengthframe anchor top+left+right width.lengthframe
text .plHeight 'Plate Height' tagwidth 9 callback '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
path right
text .plThick 'Plate Thick' tagwidth 8 width 5 is REAL
format !!boreFmt
text .rBarDia 'R-Bar Dia.' anchor top+left+right
tagwidth 8 width 5 is REAL format !!boreFmt
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
text .pitchXdir 'Pitch X-Direction' tagwidth 12 width
9 is REAL format !!distanceFmt
path right
text .pitchYdir 'Pitch Y-Direction' anchor
top+left+right tagwidth 12 width 9.25 is REAL format !!
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
width.lengthframe height 4
text .gratingPos 'Position' tagwidth 9 callback '!
this.aidGratingBox()' anchor top+left+right width 31.5 is
POSITION
path right
button .pickPosition callback '!this.pickPosition()'
anchor top+right pixmap height 16 width 16
path down
text .orientation 'Orientation' at xmin.gratingPos
anchor top+left+right tagwidth 9 callback '!this.aidGratingBox
()' width 35 is ORIENTATION
exit
button .create 'Create' at xmin.lengthframe anchor
bottom+left callback '!this.create()' linklabel
path right
button .about '?' at xmax form-size anchor bottom+right
linklabel callback '$P <$!<this>> 2015 - Aurelio Peros
Hinampas'
member .packet is EDGPACKET
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
exit
define method .createGrating()
!this.pickDimensions.setTooltip('Pick Dimensions for X-
Length & Y-Length by EDG measure.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
!this.interChange.addPixmap(!!pml.getpathname
('rotsup.png'))
!this.interChange.setTooltip('Swap X-Length & Y-Length
Dimensions.')
40
!this.pickPosition.addPixmap(!!pml.getpathname
('xyz16.png'))
!this.pickPosition.setTooltip('Set Origin of Structural
Grating by EDG Graphical Pick.')
!this.create.setTooltip('Create Structural Grating.')
!this.about.setTooltip('2015 - Aurelio Peros Hinampas')
!this.aidNumGrating = !!aidNumbers.add('Grating Aid
Number')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
!this.rBarDia.val = 10
!this.pitchXdir.val = 40
!this.pitchYdir.val = 200
!this.gratingPos.val = object POSITION('E0 N0 U0')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
define method .interChange()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
-- Swap Dimensions
!this.xLength.val = !yLen
!this.yLength.val = !xLen
!this.aidGratingBox()
endmethod
define method .pickDimensions()
-- Clear Pick Position Array
!this.pickPosi.clear()
AID CLEAR ALL $!<this.aidNumGrating>
!this.packet.definePosition('Pick Dimensions for X-Length
& Y-Length.')
!this.packet.description = 'X-Length & Y-Length'
!this.packet.action = '!!
createGrating.pickDimensionsDone(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .pickDimensionsDone(!pickedData is
EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
-- Saved Picked Position to an Array
!this.pickPosi.append(!this.position)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
$!<this.pickPosi[1]>
if (!this.pickPosi.size().eq(2)) then
!!edgCntrl.remove(!this.packetDesc)
-- X-Length Dimension
41
!xLength = !this.pickPosi[1].east - !this.pickPosi
[2].east
!this.xLength.val = !xLength.abs()
-- Y-Length Dimension
!yLength = !this.pickPosi[1].north - !this.pickPosi
[2].north
!this.yLength.val = !yLength.abs()
-- Update Grating Origin
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
!midPosi.north = !this.pickPosi[2].north
-- Construct Y-Line to get Direction
!yLine = object LINE(!this.pickPosi[1], !midPosi)
-- Construct X-Line to get Direction
!xLine = object LINE(!midPosi, !this.pickPosi[2])
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
!this.orientation.val = Y is $!<yDire> and X is $!
<xDire>
!this.aidGratingBox()
endif
endmethod
define method .pickPosition()
!this.packet.definePosition('Pick Origin of Structural
Grating.')
!this.packet.description = 'Reference Point'
!this.packet.action = '!!createGrating.positionDone
(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .positionDone(!pickedData is EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
!!edgCntrl.remove(!this.packetDesc)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
define method .aidGratingBox()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
!zLen = !this.plHeight.val
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
!zDir = !this.orientation.val.zDir()
if (!zDir.string().split()[1].upcase().eq('U')) then
!zOri = !zDir
else
42
!zOri = !zDir.opposite()
endif
!boxPos = !this.gratingPos.val.offset(!xDir,!xLen /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
-- Aid Box
AID CLEAR ALL $!<this.aidNumGrating>
AID TRANSLUCENCY 25
AID BOX NUMBER $!<this.aidNumGrating> AT $!<boxPos>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
AID TEXT NUMBER $!<this.aidNumGrating> 'Origin' AT $!
<this.gratingPos.val>
endmethod
define method .create()
!xCopies = (!this.xLength.val - !this.plThick.val) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
if (!!ce.type.eq('FRMW')) then
!frmwOwner = !!ce
else
!frmwOwner = !!dtbGetOwnerType(!!ce,'FRMW')
endif
if (!frmwOwner.unset()) then
return error 1 'Unable to find FRMW type for Grating
to be created with. Must create a FRMW first or CE must be in
or below FRMW.'
endif
if (!frmwOwner.isnamed) then
!ownerName = !frmwOwner.name
else
!ownerName = '/STRUCTURAL'
endif
do !num
if (!num.lt(10)) then
!sbfrName = !ownerName & '-GR-0' & !num
else
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
!!ce = !sbfrName.dbref()
enddo
-- Enable Undo
!undoAble = object UNDOABLE()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
!xDir = !this.orientation.val.xdir()
!yDir = !this.orientation.val.ydir()
!zDir = !this.orientation.val.zdir()
43
if (!zDir.string().split()[1].upcase().eq('D')) then
!sJus = 'UTOP'
!zOri = !zDir.opposite()
else
!sJus = 'UBOT'
!zOri = !zDir
endif
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
NEW PAVE
POSITION E 0 N ($!<this.yLength.val> - $!
<this.plThick.val>) U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.plThick.val> N ($!
<this.yLength.val> - $!<this.plThick.val>) U 0
END
-- <4>
NEW PAVE
POSITION E $!<this.plThick.val> N $!
<this.plThick.val> U 0
END
END
END
!!ce = !paneRefe
-- Copy Pane Along X-Direction
do !c from 1 to !xCopies.int()
skip if (!c.eq(!xCopies.int()) and !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
enddo
NEW PANE COPY $!<paneRefe> BY X ($!<this.xLength.val>
- $!<this.plThick.val>) WRT CE
-- End Plate 1
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
44
-- <1>
NEW PAVE
POSITION E 0 N 0 U 0
END
-- <2>
NEW PAVE
POSITION E $!<this.xLength.val> N 0 U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
-- <4>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
END
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
-- Bar Section
!spref = '/DESPAR-SPEC/Tube_with_design_parameters'
!possOffset = !this.gratingPos.val.offset(!yDir,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
this.rBarDia.val / 2))
!poseOffset = !possOffset.offset(!xDir,!
this.xLength.val)
NEW SCTN
!sctnRefe = !!ce
SPREF $!<spref>
DESP $!<this.rBarDia.val> ($!<this.rBarDia.val> /
2)
JUS NA
POSS $!<possOffset>
POSE $!<poseOffset>
DRNS PERP
DRNE PERP
END
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
enddo
if ((!yRemainder.real() * !this.pitchYdir.val) gt 10)
then
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
endif
END
-- Terminate Undo
!undoAble.endundoable()
45
AID CLEAR ALL $!<this.aidNumGrating>
endmethod
define method .dismiss()
AID CLEAR ALL $!<this.aidNumGrating>
!this.hide()
endmethodsetup form !!createGrating dialog dock
!this.formtitle = 'Create Structural Grating'
!this.cancelcall = '!this.dismiss()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
this.aidGratingBox()' width 7.5 is REAL format !!distanceFmt
text .yLength 'Y-Length' tagwidth 9 anchor
top+left+right callback '!this.aidGratingBox()' width 8 is
REAL format !!distanceFmt
line .barLenth anchor top+right vertical height 1
button .pickDimensions anchor top+right callback '!
this.pickDimensions()' pixmap height 16 width 16
button .interChange anchor top+right callback '!
this.interChange()' pixmap height 20 width 20
exit
path down
frame .plateframe 'Plate / Bar Dimensions' at
xmin.lengthframe anchor top+left+right width.lengthframe
text .plHeight 'Plate Height' tagwidth 9 callback '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
path right
text .plThick 'Plate Thick' tagwidth 8 width 5 is REAL
format !!boreFmt
text .rBarDia 'R-Bar Dia.' anchor top+left+right
tagwidth 8 width 5 is REAL format !!boreFmt
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
text .pitchXdir 'Pitch X-Direction' tagwidth 12 width
9 is REAL format !!distanceFmt
path right
text .pitchYdir 'Pitch Y-Direction' anchor
top+left+right tagwidth 12 width 9.25 is REAL format !!
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
width.lengthframe height 4
text .gratingPos 'Position' tagwidth 9 callback '!
this.aidGratingBox()' anchor top+left+right width 31.5 is
POSITION
path right
button .pickPosition callback '!this.pickPosition()'
anchor top+right pixmap height 16 width 16
path down
text .orientation 'Orientation' at xmin.gratingPos
anchor top+left+right tagwidth 9 callback '!this.aidGratingBox
()' width 35 is ORIENTATION
46
exit
button .create 'Create' at xmin.lengthframe anchor
bottom+left callback '!this.create()' linklabel
path right
button .about '?' at xmax form-size anchor bottom+right
linklabel callback '$P <$!<this>> 2015 - Aurelio Peros
Hinampas'
member .packet is EDGPACKET
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
exit
define method .createGrating()
!this.pickDimensions.setTooltip('Pick Dimensions for X-
Length & Y-Length by EDG measure.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
!this.interChange.addPixmap(!!pml.getpathname
('rotsup.png'))
!this.interChange.setTooltip('Swap X-Length & Y-Length
Dimensions.')
!this.pickPosition.addPixmap(!!pml.getpathname
('xyz16.png'))
!this.pickPosition.setTooltip('Set Origin of Structural
Grating by EDG Graphical Pick.')
!this.create.setTooltip('Create Structural Grating.')
!this.about.setTooltip('2015 - Aurelio Peros Hinampas')
!this.aidNumGrating = !!aidNumbers.add('Grating Aid
Number')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
!this.rBarDia.val = 10
!this.pitchXdir.val = 40
!this.pitchYdir.val = 200
!this.gratingPos.val = object POSITION('E0 N0 U0')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
define method .interChange()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
-- Swap Dimensions
!this.xLength.val = !yLen
!this.yLength.val = !xLen
!this.aidGratingBox()
endmethod
define method .pickDimensions()
47
-- Clear Pick Position Array
!this.pickPosi.clear()
AID CLEAR ALL $!<this.aidNumGrating>
!this.packet.definePosition('Pick Dimensions for X-Length
& Y-Length.')
!this.packet.description = 'X-Length & Y-Length'
!this.packet.action = '!!
createGrating.pickDimensionsDone(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .pickDimensionsDone(!pickedData is
EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
-- Saved Picked Position to an Array
!this.pickPosi.append(!this.position)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
$!<this.pickPosi[1]>
if (!this.pickPosi.size().eq(2)) then
!!edgCntrl.remove(!this.packetDesc)
-- X-Length Dimension
!xLength = !this.pickPosi[1].east - !this.pickPosi
[2].east
!this.xLength.val = !xLength.abs()
-- Y-Length Dimension
!yLength = !this.pickPosi[1].north - !this.pickPosi
[2].north
!this.yLength.val = !yLength.abs()
-- Update Grating Origin
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
!midPosi.north = !this.pickPosi[2].north
-- Construct Y-Line to get Direction
!yLine = object LINE(!this.pickPosi[1], !midPosi)
-- Construct X-Line to get Direction
!xLine = object LINE(!midPosi, !this.pickPosi[2])
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
!this.orientation.val = Y is $!<yDire> and X is $!
<xDire>
!this.aidGratingBox()
endif
endmethod
define method .pickPosition()
!this.packet.definePosition('Pick Origin of Structural
Grating.')
!this.packet.description = 'Reference Point'
48
!this.packet.action = '!!createGrating.positionDone
(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .positionDone(!pickedData is EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
!!edgCntrl.remove(!this.packetDesc)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
define method .aidGratingBox()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
!zLen = !this.plHeight.val
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
!zDir = !this.orientation.val.zDir()
if (!zDir.string().split()[1].upcase().eq('U')) then
!zOri = !zDir
else
!zOri = !zDir.opposite()
endif
!boxPos = !this.gratingPos.val.offset(!xDir,!xLen /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
-- Aid Box
AID CLEAR ALL $!<this.aidNumGrating>
AID TRANSLUCENCY 25
AID BOX NUMBER $!<this.aidNumGrating> AT $!<boxPos>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
AID TEXT NUMBER $!<this.aidNumGrating> 'Origin' AT $!
<this.gratingPos.val>
endmethod
define method .create()
!xCopies = (!this.xLength.val - !this.plThick.val) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
if (!!ce.type.eq('FRMW')) then
!frmwOwner = !!ce
else
!frmwOwner = !!dtbGetOwnerType(!!ce,'FRMW')
endif
if (!frmwOwner.unset()) then
return error 1 'Unable to find FRMW type for Grating
to be created with. Must create a FRMW first or CE must be in
or below FRMW.'
endif
49
if (!frmwOwner.isnamed) then
!ownerName = !frmwOwner.name
else
!ownerName = '/STRUCTURAL'
endif
do !num
if (!num.lt(10)) then
!sbfrName = !ownerName & '-GR-0' & !num
else
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
!!ce = !sbfrName.dbref()
enddo
-- Enable Undo
!undoAble = object UNDOABLE()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
!xDir = !this.orientation.val.xdir()
!yDir = !this.orientation.val.ydir()
!zDir = !this.orientation.val.zdir()
if (!zDir.string().split()[1].upcase().eq('D')) then
!sJus = 'UTOP'
!zOri = !zDir.opposite()
else
!sJus = 'UBOT'
!zOri = !zDir
endif
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
NEW PAVE
POSITION E 0 N ($!<this.yLength.val> - $!
<this.plThick.val>) U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.plThick.val> N ($!
<this.yLength.val> - $!<this.plThick.val>) U 0
END
-- <4>
NEW PAVE
50
POSITION E $!<this.plThick.val> N $!
<this.plThick.val> U 0
END
END
END
!!ce = !paneRefe
-- Copy Pane Along X-Direction
do !c from 1 to !xCopies.int()
skip if (!c.eq(!xCopies.int()) and !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
enddo
NEW PANE COPY $!<paneRefe> BY X ($!<this.xLength.val>
- $!<this.plThick.val>) WRT CE
-- End Plate 1
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N 0 U 0
END
-- <2>
NEW PAVE
POSITION E $!<this.xLength.val> N 0 U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
-- <4>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
END
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
-- Bar Section
!spref = '/DESPAR-SPEC/Tube_with_design_parameters'
!possOffset = !this.gratingPos.val.offset(!yDir,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
this.rBarDia.val / 2))
!poseOffset = !possOffset.offset(!xDir,!
this.xLength.val)
NEW SCTN
!sctnRefe = !!ce
51
SPREF $!<spref>
DESP $!<this.rBarDia.val> ($!<this.rBarDia.val> /
2)
JUS NA
POSS $!<possOffset>
POSE $!<poseOffset>
DRNS PERP
DRNE PERP
END
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
enddo
if ((!yRemainder.real() * !this.pitchYdir.val) gt 10)
then
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
endif
END
-- Terminate Undo
!undoAble.endundoable()
AID CLEAR ALL $!<this.aidNumGrating>
endmethod
define method .dismiss()
AID CLEAR ALL $!<this.aidNumGrating>
!this.hide()
endmethodsetup form !!createGrating dialog dock
!this.formtitle = 'Create Structural Grating'
!this.cancelcall = '!this.dismiss()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
this.aidGratingBox()' width 7.5 is REAL format !!distanceFmt
text .yLength 'Y-Length' tagwidth 9 anchor
top+left+right callback '!this.aidGratingBox()' width 8 is
REAL format !!distanceFmt
line .barLenth anchor top+right vertical height 1
button .pickDimensions anchor top+right callback '!
this.pickDimensions()' pixmap height 16 width 16
button .interChange anchor top+right callback '!
this.interChange()' pixmap height 20 width 20
exit
path down
frame .plateframe 'Plate / Bar Dimensions' at
xmin.lengthframe anchor top+left+right width.lengthframe
text .plHeight 'Plate Height' tagwidth 9 callback '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
path right
text .plThick 'Plate Thick' tagwidth 8 width 5 is REAL
format !!boreFmt
text .rBarDia 'R-Bar Dia.' anchor top+left+right
tagwidth 8 width 5 is REAL format !!boreFmt
52
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
text .pitchXdir 'Pitch X-Direction' tagwidth 12 width
9 is REAL format !!distanceFmt
path right
text .pitchYdir 'Pitch Y-Direction' anchor
top+left+right tagwidth 12 width 9.25 is REAL format !!
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
width.lengthframe height 4
text .gratingPos 'Position' tagwidth 9 callback '!
this.aidGratingBox()' anchor top+left+right width 31.5 is
POSITION
path right
button .pickPosition callback '!this.pickPosition()'
anchor top+right pixmap height 16 width 16
path down
text .orientation 'Orientation' at xmin.gratingPos
anchor top+left+right tagwidth 9 callback '!this.aidGratingBox
()' width 35 is ORIENTATION
exit
button .create 'Create' at xmin.lengthframe anchor
bottom+left callback '!this.create()' linklabel
path right
button .about '?' at xmax form-size anchor bottom+right
linklabel callback '$P <$!<this>> 2015 - Aurelio Peros
Hinampas'
member .packet is EDGPACKET
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
exit
define method .createGrating()
!this.pickDimensions.setTooltip('Pick Dimensions for X-
Length & Y-Length by EDG measure.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
!this.interChange.addPixmap(!!pml.getpathname
('rotsup.png'))
!this.interChange.setTooltip('Swap X-Length & Y-Length
Dimensions.')
!this.pickPosition.addPixmap(!!pml.getpathname
('xyz16.png'))
!this.pickPosition.setTooltip('Set Origin of Structural
Grating by EDG Graphical Pick.')
!this.create.setTooltip('Create Structural Grating.')
!this.about.setTooltip('2015 - Aurelio Peros Hinampas')
!this.aidNumGrating = !!aidNumbers.add('Grating Aid
Number')
53
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
!this.rBarDia.val = 10
!this.pitchXdir.val = 40
!this.pitchYdir.val = 200
!this.gratingPos.val = object POSITION('E0 N0 U0')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
define method .interChange()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
-- Swap Dimensions
!this.xLength.val = !yLen
!this.yLength.val = !xLen
!this.aidGratingBox()
endmethod
define method .pickDimensions()
-- Clear Pick Position Array
!this.pickPosi.clear()
AID CLEAR ALL $!<this.aidNumGrating>
!this.packet.definePosition('Pick Dimensions for X-Length
& Y-Length.')
!this.packet.description = 'X-Length & Y-Length'
!this.packet.action = '!!
createGrating.pickDimensionsDone(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .pickDimensionsDone(!pickedData is
EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
-- Saved Picked Position to an Array
!this.pickPosi.append(!this.position)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
$!<this.pickPosi[1]>
if (!this.pickPosi.size().eq(2)) then
!!edgCntrl.remove(!this.packetDesc)
-- X-Length Dimension
!xLength = !this.pickPosi[1].east - !this.pickPosi
[2].east
!this.xLength.val = !xLength.abs()
-- Y-Length Dimension
!yLength = !this.pickPosi[1].north - !this.pickPosi
[2].north
!this.yLength.val = !yLength.abs()
-- Update Grating Origin
54
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
!midPosi.north = !this.pickPosi[2].north
-- Construct Y-Line to get Direction
!yLine = object LINE(!this.pickPosi[1], !midPosi)
-- Construct X-Line to get Direction
!xLine = object LINE(!midPosi, !this.pickPosi[2])
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
!this.orientation.val = Y is $!<yDire> and X is $!
<xDire>
!this.aidGratingBox()
endif
endmethod
define method .pickPosition()
!this.packet.definePosition('Pick Origin of Structural
Grating.')
!this.packet.description = 'Reference Point'
!this.packet.action = '!!createGrating.positionDone
(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .positionDone(!pickedData is EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
!!edgCntrl.remove(!this.packetDesc)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
define method .aidGratingBox()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
!zLen = !this.plHeight.val
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
!zDir = !this.orientation.val.zDir()
if (!zDir.string().split()[1].upcase().eq('U')) then
!zOri = !zDir
else
!zOri = !zDir.opposite()
endif
!boxPos = !this.gratingPos.val.offset(!xDir,!xLen /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
-- Aid Box
AID CLEAR ALL $!<this.aidNumGrating>
AID TRANSLUCENCY 25
AID BOX NUMBER $!<this.aidNumGrating> AT $!<boxPos>
55
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
AID TEXT NUMBER $!<this.aidNumGrating> 'Origin' AT $!
<this.gratingPos.val>
endmethod
define method .create()
!xCopies = (!this.xLength.val - !this.plThick.val) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
if (!!ce.type.eq('FRMW')) then
!frmwOwner = !!ce
else
!frmwOwner = !!dtbGetOwnerType(!!ce,'FRMW')
endif
if (!frmwOwner.unset()) then
return error 1 'Unable to find FRMW type for Grating
to be created with. Must create a FRMW first or CE must be in
or below FRMW.'
endif
if (!frmwOwner.isnamed) then
!ownerName = !frmwOwner.name
else
!ownerName = '/STRUCTURAL'
endif
do !num
if (!num.lt(10)) then
!sbfrName = !ownerName & '-GR-0' & !num
else
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
!!ce = !sbfrName.dbref()
enddo
-- Enable Undo
!undoAble = object UNDOABLE()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
!xDir = !this.orientation.val.xdir()
!yDir = !this.orientation.val.ydir()
!zDir = !this.orientation.val.zdir()
if (!zDir.string().split()[1].upcase().eq('D')) then
!sJus = 'UTOP'
!zOri = !zDir.opposite()
else
!sJus = 'UBOT'
!zOri = !zDir
endif
56
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
NEW PAVE
POSITION E 0 N ($!<this.yLength.val> - $!
<this.plThick.val>) U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.plThick.val> N ($!
<this.yLength.val> - $!<this.plThick.val>) U 0
END
-- <4>
NEW PAVE
POSITION E $!<this.plThick.val> N $!
<this.plThick.val> U 0
END
END
END
!!ce = !paneRefe
-- Copy Pane Along X-Direction
do !c from 1 to !xCopies.int()
skip if (!c.eq(!xCopies.int()) and !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
enddo
NEW PANE COPY $!<paneRefe> BY X ($!<this.xLength.val>
- $!<this.plThick.val>) WRT CE
-- End Plate 1
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N 0 U 0
END
-- <2>
NEW PAVE
POSITION E $!<this.xLength.val> N 0 U 0
END
-- <3>
57
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
-- <4>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
END
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
-- Bar Section
!spref = '/DESPAR-SPEC/Tube_with_design_parameters'
!possOffset = !this.gratingPos.val.offset(!yDir,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
this.rBarDia.val / 2))
!poseOffset = !possOffset.offset(!xDir,!
this.xLength.val)
NEW SCTN
!sctnRefe = !!ce
SPREF $!<spref>
DESP $!<this.rBarDia.val> ($!<this.rBarDia.val> /
2)
JUS NA
POSS $!<possOffset>
POSE $!<poseOffset>
DRNS PERP
DRNE PERP
END
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
enddo
if ((!yRemainder.real() * !this.pitchYdir.val) gt 10)
then
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
endif
END
-- Terminate Undo
!undoAble.endundoable()
AID CLEAR ALL $!<this.aidNumGrating>
endmethod
define method .dismiss()
AID CLEAR ALL $!<this.aidNumGrating>
!this.hide()
endmethodsetup form !!createGrating dialog dock
!this.formtitle = 'Create Structural Grating'
!this.cancelcall = '!this.dismiss()'
58
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
this.aidGratingBox()' width 7.5 is REAL format !!distanceFmt
text .yLength 'Y-Length' tagwidth 9 anchor
top+left+right callback '!this.aidGratingBox()' width 8 is
REAL format !!distanceFmt
line .barLenth anchor top+right vertical height 1
button .pickDimensions anchor top+right callback '!
this.pickDimensions()' pixmap height 16 width 16
button .interChange anchor top+right callback '!
this.interChange()' pixmap height 20 width 20
exit
path down
frame .plateframe 'Plate / Bar Dimensions' at
xmin.lengthframe anchor top+left+right width.lengthframe
text .plHeight 'Plate Height' tagwidth 9 callback '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
path right
text .plThick 'Plate Thick' tagwidth 8 width 5 is REAL
format !!boreFmt
text .rBarDia 'R-Bar Dia.' anchor top+left+right
tagwidth 8 width 5 is REAL format !!boreFmt
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
text .pitchXdir 'Pitch X-Direction' tagwidth 12 width
9 is REAL format !!distanceFmt
path right
text .pitchYdir 'Pitch Y-Direction' anchor
top+left+right tagwidth 12 width 9.25 is REAL format !!
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
width.lengthframe height 4
text .gratingPos 'Position' tagwidth 9 callback '!
this.aidGratingBox()' anchor top+left+right width 31.5 is
POSITION
path right
button .pickPosition callback '!this.pickPosition()'
anchor top+right pixmap height 16 width 16
path down
text .orientation 'Orientation' at xmin.gratingPos
anchor top+left+right tagwidth 9 callback '!this.aidGratingBox
()' width 35 is ORIENTATION
exit
button .create 'Create' at xmin.lengthframe anchor
bottom+left callback '!this.create()' linklabel
path right
button .about '?' at xmax form-size anchor bottom+right
linklabel callback '$P <$!<this>> 2015 - Aurelio Peros
Hinampas'
member .packet is EDGPACKET
59
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
exit
define method .createGrating()
!this.pickDimensions.setTooltip('Pick Dimensions for X-
Length & Y-Length by EDG measure.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
!this.interChange.addPixmap(!!pml.getpathname
('rotsup.png'))
!this.interChange.setTooltip('Swap X-Length & Y-Length
Dimensions.')
!this.pickPosition.addPixmap(!!pml.getpathname
('xyz16.png'))
!this.pickPosition.setTooltip('Set Origin of Structural
Grating by EDG Graphical Pick.')
!this.create.setTooltip('Create Structural Grating.')
!this.about.setTooltip('2015 - Aurelio Peros Hinampas')
!this.aidNumGrating = !!aidNumbers.add('Grating Aid
Number')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
!this.rBarDia.val = 10
!this.pitchXdir.val = 40
!this.pitchYdir.val = 200
!this.gratingPos.val = object POSITION('E0 N0 U0')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
define method .interChange()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
-- Swap Dimensions
!this.xLength.val = !yLen
!this.yLength.val = !xLen
!this.aidGratingBox()
endmethod
define method .pickDimensions()
-- Clear Pick Position Array
!this.pickPosi.clear()
AID CLEAR ALL $!<this.aidNumGrating>
!this.packet.definePosition('Pick Dimensions for X-Length
& Y-Length.')
!this.packet.description = 'X-Length & Y-Length'
!this.packet.action = '!!
createGrating.pickDimensionsDone(!this.return[1])'
60
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .pickDimensionsDone(!pickedData is
EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
-- Saved Picked Position to an Array
!this.pickPosi.append(!this.position)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
$!<this.pickPosi[1]>
if (!this.pickPosi.size().eq(2)) then
!!edgCntrl.remove(!this.packetDesc)
-- X-Length Dimension
!xLength = !this.pickPosi[1].east - !this.pickPosi
[2].east
!this.xLength.val = !xLength.abs()
-- Y-Length Dimension
!yLength = !this.pickPosi[1].north - !this.pickPosi
[2].north
!this.yLength.val = !yLength.abs()
-- Update Grating Origin
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
!midPosi.north = !this.pickPosi[2].north
-- Construct Y-Line to get Direction
!yLine = object LINE(!this.pickPosi[1], !midPosi)
-- Construct X-Line to get Direction
!xLine = object LINE(!midPosi, !this.pickPosi[2])
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
!this.orientation.val = Y is $!<yDire> and X is $!
<xDire>
!this.aidGratingBox()
endif
endmethod
define method .pickPosition()
!this.packet.definePosition('Pick Origin of Structural
Grating.')
!this.packet.description = 'Reference Point'
!this.packet.action = '!!createGrating.positionDone
(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .positionDone(!pickedData is EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
!!edgCntrl.remove(!this.packetDesc)
61
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
define method .aidGratingBox()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
!zLen = !this.plHeight.val
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
!zDir = !this.orientation.val.zDir()
if (!zDir.string().split()[1].upcase().eq('U')) then
!zOri = !zDir
else
!zOri = !zDir.opposite()
endif
!boxPos = !this.gratingPos.val.offset(!xDir,!xLen /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
-- Aid Box
AID CLEAR ALL $!<this.aidNumGrating>
AID TRANSLUCENCY 25
AID BOX NUMBER $!<this.aidNumGrating> AT $!<boxPos>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
AID TEXT NUMBER $!<this.aidNumGrating> 'Origin' AT $!
<this.gratingPos.val>
endmethod
define method .create()
!xCopies = (!this.xLength.val - !this.plThick.val) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
if (!!ce.type.eq('FRMW')) then
!frmwOwner = !!ce
else
!frmwOwner = !!dtbGetOwnerType(!!ce,'FRMW')
endif
if (!frmwOwner.unset()) then
return error 1 'Unable to find FRMW type for Grating
to be created with. Must create a FRMW first or CE must be in
or below FRMW.'
endif
if (!frmwOwner.isnamed) then
!ownerName = !frmwOwner.name
else
!ownerName = '/STRUCTURAL'
endif
do !num
if (!num.lt(10)) then
!sbfrName = !ownerName & '-GR-0' & !num
else
62
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
!!ce = !sbfrName.dbref()
enddo
-- Enable Undo
!undoAble = object UNDOABLE()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
!xDir = !this.orientation.val.xdir()
!yDir = !this.orientation.val.ydir()
!zDir = !this.orientation.val.zdir()
if (!zDir.string().split()[1].upcase().eq('D')) then
!sJus = 'UTOP'
!zOri = !zDir.opposite()
else
!sJus = 'UBOT'
!zOri = !zDir
endif
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
NEW PAVE
POSITION E 0 N ($!<this.yLength.val> - $!
<this.plThick.val>) U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.plThick.val> N ($!
<this.yLength.val> - $!<this.plThick.val>) U 0
END
-- <4>
NEW PAVE
POSITION E $!<this.plThick.val> N $!
<this.plThick.val> U 0
END
END
END
!!ce = !paneRefe
-- Copy Pane Along X-Direction
do !c from 1 to !xCopies.int()
skip if (!c.eq(!xCopies.int()) and !
63
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
enddo
NEW PANE COPY $!<paneRefe> BY X ($!<this.xLength.val>
- $!<this.plThick.val>) WRT CE
-- End Plate 1
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N 0 U 0
END
-- <2>
NEW PAVE
POSITION E $!<this.xLength.val> N 0 U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
-- <4>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
END
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
-- Bar Section
!spref = '/DESPAR-SPEC/Tube_with_design_parameters'
!possOffset = !this.gratingPos.val.offset(!yDir,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
this.rBarDia.val / 2))
!poseOffset = !possOffset.offset(!xDir,!
this.xLength.val)
NEW SCTN
!sctnRefe = !!ce
SPREF $!<spref>
DESP $!<this.rBarDia.val> ($!<this.rBarDia.val> /
2)
JUS NA
POSS $!<possOffset>
POSE $!<poseOffset>
DRNS PERP
DRNE PERP
END
64
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
enddo
if ((!yRemainder.real() * !this.pitchYdir.val) gt 10)
then
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
endif
END
-- Terminate Undo
!undoAble.endundoable()
AID CLEAR ALL $!<this.aidNumGrating>
endmethod
define method .dismiss()
AID CLEAR ALL $!<this.aidNumGrating>
!this.hide()
endmethodsetup form !!createGrating dialog dock
!this.formtitle = 'Create Structural Grating'
!this.cancelcall = '!this.dismiss()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
this.aidGratingBox()' width 7.5 is REAL format !!distanceFmt
text .yLength 'Y-Length' tagwidth 9 anchor
top+left+right callback '!this.aidGratingBox()' width 8 is
REAL format !!distanceFmt
line .barLenth anchor top+right vertical height 1
button .pickDimensions anchor top+right callback '!
this.pickDimensions()' pixmap height 16 width 16
button .interChange anchor top+right callback '!
this.interChange()' pixmap height 20 width 20
exit
path down
frame .plateframe 'Plate / Bar Dimensions' at
xmin.lengthframe anchor top+left+right width.lengthframe
text .plHeight 'Plate Height' tagwidth 9 callback '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
path right
text .plThick 'Plate Thick' tagwidth 8 width 5 is REAL
format !!boreFmt
text .rBarDia 'R-Bar Dia.' anchor top+left+right
tagwidth 8 width 5 is REAL format !!boreFmt
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
text .pitchXdir 'Pitch X-Direction' tagwidth 12 width
9 is REAL format !!distanceFmt
path right
text .pitchYdir 'Pitch Y-Direction' anchor
top+left+right tagwidth 12 width 9.25 is REAL format !!
65
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
width.lengthframe height 4
text .gratingPos 'Position' tagwidth 9 callback '!
this.aidGratingBox()' anchor top+left+right width 31.5 is
POSITION
path right
button .pickPosition callback '!this.pickPosition()'
anchor top+right pixmap height 16 width 16
path down
text .orientation 'Orientation' at xmin.gratingPos
anchor top+left+right tagwidth 9 callback '!this.aidGratingBox
()' width 35 is ORIENTATION
exit
button .create 'Create' at xmin.lengthframe anchor
bottom+left callback '!this.create()' linklabel
path right
button .about '?' at xmax form-size anchor bottom+right
linklabel callback '$P <$!<this>> 2015 - Aurelio Peros
Hinampas'
member .packet is EDGPACKET
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
exit
define method .createGrating()
!this.pickDimensions.setTooltip('Pick Dimensions for X-
Length & Y-Length by EDG measure.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
!this.interChange.addPixmap(!!pml.getpathname
('rotsup.png'))
!this.interChange.setTooltip('Swap X-Length & Y-Length
Dimensions.')
!this.pickPosition.addPixmap(!!pml.getpathname
('xyz16.png'))
!this.pickPosition.setTooltip('Set Origin of Structural
Grating by EDG Graphical Pick.')
!this.create.setTooltip('Create Structural Grating.')
!this.about.setTooltip('2015 - Aurelio Peros Hinampas')
!this.aidNumGrating = !!aidNumbers.add('Grating Aid
Number')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
!this.rBarDia.val = 10
!this.pitchXdir.val = 40
!this.pitchYdir.val = 200
!this.gratingPos.val = object POSITION('E0 N0 U0')
66
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
define method .interChange()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
-- Swap Dimensions
!this.xLength.val = !yLen
!this.yLength.val = !xLen
!this.aidGratingBox()
endmethod
define method .pickDimensions()
-- Clear Pick Position Array
!this.pickPosi.clear()
AID CLEAR ALL $!<this.aidNumGrating>
!this.packet.definePosition('Pick Dimensions for X-Length
& Y-Length.')
!this.packet.description = 'X-Length & Y-Length'
!this.packet.action = '!!
createGrating.pickDimensionsDone(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .pickDimensionsDone(!pickedData is
EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
-- Saved Picked Position to an Array
!this.pickPosi.append(!this.position)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
$!<this.pickPosi[1]>
if (!this.pickPosi.size().eq(2)) then
!!edgCntrl.remove(!this.packetDesc)
-- X-Length Dimension
!xLength = !this.pickPosi[1].east - !this.pickPosi
[2].east
!this.xLength.val = !xLength.abs()
-- Y-Length Dimension
!yLength = !this.pickPosi[1].north - !this.pickPosi
[2].north
!this.yLength.val = !yLength.abs()
-- Update Grating Origin
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
!midPosi.north = !this.pickPosi[2].north
-- Construct Y-Line to get Direction
!yLine = object LINE(!this.pickPosi[1], !midPosi)
-- Construct X-Line to get Direction
!xLine = object LINE(!midPosi, !this.pickPosi[2])
67
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
!this.orientation.val = Y is $!<yDire> and X is $!
<xDire>
!this.aidGratingBox()
endif
endmethod
define method .pickPosition()
!this.packet.definePosition('Pick Origin of Structural
Grating.')
!this.packet.description = 'Reference Point'
!this.packet.action = '!!createGrating.positionDone
(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .positionDone(!pickedData is EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
!!edgCntrl.remove(!this.packetDesc)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
define method .aidGratingBox()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
!zLen = !this.plHeight.val
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
!zDir = !this.orientation.val.zDir()
if (!zDir.string().split()[1].upcase().eq('U')) then
!zOri = !zDir
else
!zOri = !zDir.opposite()
endif
!boxPos = !this.gratingPos.val.offset(!xDir,!xLen /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
-- Aid Box
AID CLEAR ALL $!<this.aidNumGrating>
AID TRANSLUCENCY 25
AID BOX NUMBER $!<this.aidNumGrating> AT $!<boxPos>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
AID TEXT NUMBER $!<this.aidNumGrating> 'Origin' AT $!
<this.gratingPos.val>
endmethod
define method .create()
!xCopies = (!this.xLength.val - !this.plThick.val) / !
68
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
if (!!ce.type.eq('FRMW')) then
!frmwOwner = !!ce
else
!frmwOwner = !!dtbGetOwnerType(!!ce,'FRMW')
endif
if (!frmwOwner.unset()) then
return error 1 'Unable to find FRMW type for Grating
to be created with. Must create a FRMW first or CE must be in
or below FRMW.'
endif
if (!frmwOwner.isnamed) then
!ownerName = !frmwOwner.name
else
!ownerName = '/STRUCTURAL'
endif
do !num
if (!num.lt(10)) then
!sbfrName = !ownerName & '-GR-0' & !num
else
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
!!ce = !sbfrName.dbref()
enddo
-- Enable Undo
!undoAble = object UNDOABLE()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
!xDir = !this.orientation.val.xdir()
!yDir = !this.orientation.val.ydir()
!zDir = !this.orientation.val.zdir()
if (!zDir.string().split()[1].upcase().eq('D')) then
!sJus = 'UTOP'
!zOri = !zDir.opposite()
else
!sJus = 'UBOT'
!zOri = !zDir
endif
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
69
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
NEW PAVE
POSITION E 0 N ($!<this.yLength.val> - $!
<this.plThick.val>) U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.plThick.val> N ($!
<this.yLength.val> - $!<this.plThick.val>) U 0
END
-- <4>
NEW PAVE
POSITION E $!<this.plThick.val> N $!
<this.plThick.val> U 0
END
END
END
!!ce = !paneRefe
-- Copy Pane Along X-Direction
do !c from 1 to !xCopies.int()
skip if (!c.eq(!xCopies.int()) and !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
enddo
NEW PANE COPY $!<paneRefe> BY X ($!<this.xLength.val>
- $!<this.plThick.val>) WRT CE
-- End Plate 1
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N 0 U 0
END
-- <2>
NEW PAVE
POSITION E $!<this.xLength.val> N 0 U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
-- <4>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
END
70
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
-- Bar Section
!spref = '/DESPAR-SPEC/Tube_with_design_parameters'
!possOffset = !this.gratingPos.val.offset(!yDir,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
this.rBarDia.val / 2))
!poseOffset = !possOffset.offset(!xDir,!
this.xLength.val)
NEW SCTN
!sctnRefe = !!ce
SPREF $!<spref>
DESP $!<this.rBarDia.val> ($!<this.rBarDia.val> /
2)
JUS NA
POSS $!<possOffset>
POSE $!<poseOffset>
DRNS PERP
DRNE PERP
END
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
enddo
if ((!yRemainder.real() * !this.pitchYdir.val) gt 10)
then
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
endif
END
-- Terminate Undo
!undoAble.endundoable()
AID CLEAR ALL $!<this.aidNumGrating>
endmethod
define method .dismiss()
AID CLEAR ALL $!<this.aidNumGrating>
!this.hide()
endmethodsetup form !!createGrating dialog dock
!this.formtitle = 'Create Structural Grating'
!this.cancelcall = '!this.dismiss()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
this.aidGratingBox()' width 7.5 is REAL format !!distanceFmt
text .yLength 'Y-Length' tagwidth 9 anchor
top+left+right callback '!this.aidGratingBox()' width 8 is
REAL format !!distanceFmt
line .barLenth anchor top+right vertical height 1
71
button .pickDimensions anchor top+right callback '!
this.pickDimensions()' pixmap height 16 width 16
button .interChange anchor top+right callback '!
this.interChange()' pixmap height 20 width 20
exit
path down
frame .plateframe 'Plate / Bar Dimensions' at
xmin.lengthframe anchor top+left+right width.lengthframe
text .plHeight 'Plate Height' tagwidth 9 callback '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
path right
text .plThick 'Plate Thick' tagwidth 8 width 5 is REAL
format !!boreFmt
text .rBarDia 'R-Bar Dia.' anchor top+left+right
tagwidth 8 width 5 is REAL format !!boreFmt
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
text .pitchXdir 'Pitch X-Direction' tagwidth 12 width
9 is REAL format !!distanceFmt
path right
text .pitchYdir 'Pitch Y-Direction' anchor
top+left+right tagwidth 12 width 9.25 is REAL format !!
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
width.lengthframe height 4
text .gratingPos 'Position' tagwidth 9 callback '!
this.aidGratingBox()' anchor top+left+right width 31.5 is
POSITION
path right
button .pickPosition callback '!this.pickPosition()'
anchor top+right pixmap height 16 width 16
path down
text .orientation 'Orientation' at xmin.gratingPos
anchor top+left+right tagwidth 9 callback '!this.aidGratingBox
()' width 35 is ORIENTATION
exit
button .create 'Create' at xmin.lengthframe anchor
bottom+left callback '!this.create()' linklabel
path right
button .about '?' at xmax form-size anchor bottom+right
linklabel callback '$P <$!<this>> 2015 - Aurelio Peros
Hinampas'
member .packet is EDGPACKET
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
exit
define method .createGrating()
!this.pickDimensions.setTooltip('Pick Dimensions for X-
Length & Y-Length by EDG measure.')
72
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
!this.interChange.addPixmap(!!pml.getpathname
('rotsup.png'))
!this.interChange.setTooltip('Swap X-Length & Y-Length
Dimensions.')
!this.pickPosition.addPixmap(!!pml.getpathname
('xyz16.png'))
!this.pickPosition.setTooltip('Set Origin of Structural
Grating by EDG Graphical Pick.')
!this.create.setTooltip('Create Structural Grating.')
!this.about.setTooltip('2015 - Aurelio Peros Hinampas')
!this.aidNumGrating = !!aidNumbers.add('Grating Aid
Number')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
!this.rBarDia.val = 10
!this.pitchXdir.val = 40
!this.pitchYdir.val = 200
!this.gratingPos.val = object POSITION('E0 N0 U0')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
define method .interChange()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
-- Swap Dimensions
!this.xLength.val = !yLen
!this.yLength.val = !xLen
!this.aidGratingBox()
endmethod
define method .pickDimensions()
-- Clear Pick Position Array
!this.pickPosi.clear()
AID CLEAR ALL $!<this.aidNumGrating>
!this.packet.definePosition('Pick Dimensions for X-Length
& Y-Length.')
!this.packet.description = 'X-Length & Y-Length'
!this.packet.action = '!!
createGrating.pickDimensionsDone(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .pickDimensionsDone(!pickedData is
EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
-- Saved Picked Position to an Array
!this.pickPosi.append(!this.position)
73
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
$!<this.pickPosi[1]>
if (!this.pickPosi.size().eq(2)) then
!!edgCntrl.remove(!this.packetDesc)
-- X-Length Dimension
!xLength = !this.pickPosi[1].east - !this.pickPosi
[2].east
!this.xLength.val = !xLength.abs()
-- Y-Length Dimension
!yLength = !this.pickPosi[1].north - !this.pickPosi
[2].north
!this.yLength.val = !yLength.abs()
-- Update Grating Origin
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
!midPosi.north = !this.pickPosi[2].north
-- Construct Y-Line to get Direction
!yLine = object LINE(!this.pickPosi[1], !midPosi)
-- Construct X-Line to get Direction
!xLine = object LINE(!midPosi, !this.pickPosi[2])
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
!this.orientation.val = Y is $!<yDire> and X is $!
<xDire>
!this.aidGratingBox()
endif
endmethod
define method .pickPosition()
!this.packet.definePosition('Pick Origin of Structural
Grating.')
!this.packet.description = 'Reference Point'
!this.packet.action = '!!createGrating.positionDone
(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .positionDone(!pickedData is EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
!!edgCntrl.remove(!this.packetDesc)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
define method .aidGratingBox()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
!zLen = !this.plHeight.val
74
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
!zDir = !this.orientation.val.zDir()
if (!zDir.string().split()[1].upcase().eq('U')) then
!zOri = !zDir
else
!zOri = !zDir.opposite()
endif
!boxPos = !this.gratingPos.val.offset(!xDir,!xLen /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
-- Aid Box
AID CLEAR ALL $!<this.aidNumGrating>
AID TRANSLUCENCY 25
AID BOX NUMBER $!<this.aidNumGrating> AT $!<boxPos>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
AID TEXT NUMBER $!<this.aidNumGrating> 'Origin' AT $!
<this.gratingPos.val>
endmethod
define method .create()
!xCopies = (!this.xLength.val - !this.plThick.val) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
if (!!ce.type.eq('FRMW')) then
!frmwOwner = !!ce
else
!frmwOwner = !!dtbGetOwnerType(!!ce,'FRMW')
endif
if (!frmwOwner.unset()) then
return error 1 'Unable to find FRMW type for Grating
to be created with. Must create a FRMW first or CE must be in
or below FRMW.'
endif
if (!frmwOwner.isnamed) then
!ownerName = !frmwOwner.name
else
!ownerName = '/STRUCTURAL'
endif
do !num
if (!num.lt(10)) then
!sbfrName = !ownerName & '-GR-0' & !num
else
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
!!ce = !sbfrName.dbref()
enddo
-- Enable Undo
!undoAble = object UNDOABLE()
75
!undoAble.description('Created Structural Grating.')
!undoAble.add()
!xDir = !this.orientation.val.xdir()
!yDir = !this.orientation.val.ydir()
!zDir = !this.orientation.val.zdir()
if (!zDir.string().split()[1].upcase().eq('D')) then
!sJus = 'UTOP'
!zOri = !zDir.opposite()
else
!sJus = 'UBOT'
!zOri = !zDir
endif
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
NEW PAVE
POSITION E 0 N ($!<this.yLength.val> - $!
<this.plThick.val>) U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.plThick.val> N ($!
<this.yLength.val> - $!<this.plThick.val>) U 0
END
-- <4>
NEW PAVE
POSITION E $!<this.plThick.val> N $!
<this.plThick.val> U 0
END
END
END
!!ce = !paneRefe
-- Copy Pane Along X-Direction
do !c from 1 to !xCopies.int()
skip if (!c.eq(!xCopies.int()) and !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
enddo
NEW PANE COPY $!<paneRefe> BY X ($!<this.xLength.val>
- $!<this.plThick.val>) WRT CE
-- End Plate 1
NEW PANE
76
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N 0 U 0
END
-- <2>
NEW PAVE
POSITION E $!<this.xLength.val> N 0 U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
-- <4>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
END
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
-- Bar Section
!spref = '/DESPAR-SPEC/Tube_with_design_parameters'
!possOffset = !this.gratingPos.val.offset(!yDir,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
this.rBarDia.val / 2))
!poseOffset = !possOffset.offset(!xDir,!
this.xLength.val)
NEW SCTN
!sctnRefe = !!ce
SPREF $!<spref>
DESP $!<this.rBarDia.val> ($!<this.rBarDia.val> /
2)
JUS NA
POSS $!<possOffset>
POSE $!<poseOffset>
DRNS PERP
DRNE PERP
END
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
enddo
if ((!yRemainder.real() * !this.pitchYdir.val) gt 10)
then
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
77
endif
END
-- Terminate Undo
!undoAble.endundoable()
AID CLEAR ALL $!<this.aidNumGrating>
endmethod
define method .dismiss()
AID CLEAR ALL $!<this.aidNumGrating>
!this.hide()
endmethodsetup form !!createGrating dialog dock
!this.formtitle = 'Create Structural Grating'
!this.cancelcall = '!this.dismiss()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
this.aidGratingBox()' width 7.5 is REAL format !!distanceFmt
text .yLength 'Y-Length' tagwidth 9 anchor
top+left+right callback '!this.aidGratingBox()' width 8 is
REAL format !!distanceFmt
line .barLenth anchor top+right vertical height 1
button .pickDimensions anchor top+right callback '!
this.pickDimensions()' pixmap height 16 width 16
button .interChange anchor top+right callback '!
this.interChange()' pixmap height 20 width 20
exit
path down
frame .plateframe 'Plate / Bar Dimensions' at
xmin.lengthframe anchor top+left+right width.lengthframe
text .plHeight 'Plate Height' tagwidth 9 callback '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
path right
text .plThick 'Plate Thick' tagwidth 8 width 5 is REAL
format !!boreFmt
text .rBarDia 'R-Bar Dia.' anchor top+left+right
tagwidth 8 width 5 is REAL format !!boreFmt
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
text .pitchXdir 'Pitch X-Direction' tagwidth 12 width
9 is REAL format !!distanceFmt
path right
text .pitchYdir 'Pitch Y-Direction' anchor
top+left+right tagwidth 12 width 9.25 is REAL format !!
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
width.lengthframe height 4
text .gratingPos 'Position' tagwidth 9 callback '!
this.aidGratingBox()' anchor top+left+right width 31.5 is
POSITION
path right
78
button .pickPosition callback '!this.pickPosition()'
anchor top+right pixmap height 16 width 16
path down
text .orientation 'Orientation' at xmin.gratingPos
anchor top+left+right tagwidth 9 callback '!this.aidGratingBox
()' width 35 is ORIENTATION
exit
button .create 'Create' at xmin.lengthframe anchor
bottom+left callback '!this.create()' linklabel
path right
button .about '?' at xmax form-size anchor bottom+right
linklabel callback '$P <$!<this>> 2015 - Aurelio Peros
Hinampas'
member .packet is EDGPACKET
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
exit
define method .createGrating()
!this.pickDimensions.setTooltip('Pick Dimensions for X-
Length & Y-Length by EDG measure.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
!this.interChange.addPixmap(!!pml.getpathname
('rotsup.png'))
!this.interChange.setTooltip('Swap X-Length & Y-Length
Dimensions.')
!this.pickPosition.addPixmap(!!pml.getpathname
('xyz16.png'))
!this.pickPosition.setTooltip('Set Origin of Structural
Grating by EDG Graphical Pick.')
!this.create.setTooltip('Create Structural Grating.')
!this.about.setTooltip('2015 - Aurelio Peros Hinampas')
!this.aidNumGrating = !!aidNumbers.add('Grating Aid
Number')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
!this.rBarDia.val = 10
!this.pitchXdir.val = 40
!this.pitchYdir.val = 200
!this.gratingPos.val = object POSITION('E0 N0 U0')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
define method .interChange()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
-- Swap Dimensions
!this.xLength.val = !yLen
79
!this.yLength.val = !xLen
!this.aidGratingBox()
endmethod
define method .pickDimensions()
-- Clear Pick Position Array
!this.pickPosi.clear()
AID CLEAR ALL $!<this.aidNumGrating>
!this.packet.definePosition('Pick Dimensions for X-Length
& Y-Length.')
!this.packet.description = 'X-Length & Y-Length'
!this.packet.action = '!!
createGrating.pickDimensionsDone(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .pickDimensionsDone(!pickedData is
EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
-- Saved Picked Position to an Array
!this.pickPosi.append(!this.position)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
$!<this.pickPosi[1]>
if (!this.pickPosi.size().eq(2)) then
!!edgCntrl.remove(!this.packetDesc)
-- X-Length Dimension
!xLength = !this.pickPosi[1].east - !this.pickPosi
[2].east
!this.xLength.val = !xLength.abs()
-- Y-Length Dimension
!yLength = !this.pickPosi[1].north - !this.pickPosi
[2].north
!this.yLength.val = !yLength.abs()
-- Update Grating Origin
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
!midPosi.north = !this.pickPosi[2].north
-- Construct Y-Line to get Direction
!yLine = object LINE(!this.pickPosi[1], !midPosi)
-- Construct X-Line to get Direction
!xLine = object LINE(!midPosi, !this.pickPosi[2])
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
!this.orientation.val = Y is $!<yDire> and X is $!
<xDire>
!this.aidGratingBox()
endif
80
endmethod
define method .pickPosition()
!this.packet.definePosition('Pick Origin of Structural
Grating.')
!this.packet.description = 'Reference Point'
!this.packet.action = '!!createGrating.positionDone
(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .positionDone(!pickedData is EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
!!edgCntrl.remove(!this.packetDesc)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
define method .aidGratingBox()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
!zLen = !this.plHeight.val
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
!zDir = !this.orientation.val.zDir()
if (!zDir.string().split()[1].upcase().eq('U')) then
!zOri = !zDir
else
!zOri = !zDir.opposite()
endif
!boxPos = !this.gratingPos.val.offset(!xDir,!xLen /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
-- Aid Box
AID CLEAR ALL $!<this.aidNumGrating>
AID TRANSLUCENCY 25
AID BOX NUMBER $!<this.aidNumGrating> AT $!<boxPos>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
AID TEXT NUMBER $!<this.aidNumGrating> 'Origin' AT $!
<this.gratingPos.val>
endmethod
define method .create()
!xCopies = (!this.xLength.val - !this.plThick.val) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
if (!!ce.type.eq('FRMW')) then
!frmwOwner = !!ce
else
!frmwOwner = !!dtbGetOwnerType(!!ce,'FRMW')
81
endif
if (!frmwOwner.unset()) then
return error 1 'Unable to find FRMW type for Grating
to be created with. Must create a FRMW first or CE must be in
or below FRMW.'
endif
if (!frmwOwner.isnamed) then
!ownerName = !frmwOwner.name
else
!ownerName = '/STRUCTURAL'
endif
do !num
if (!num.lt(10)) then
!sbfrName = !ownerName & '-GR-0' & !num
else
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
!!ce = !sbfrName.dbref()
enddo
-- Enable Undo
!undoAble = object UNDOABLE()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
!xDir = !this.orientation.val.xdir()
!yDir = !this.orientation.val.ydir()
!zDir = !this.orientation.val.zdir()
if (!zDir.string().split()[1].upcase().eq('D')) then
!sJus = 'UTOP'
!zOri = !zDir.opposite()
else
!sJus = 'UBOT'
!zOri = !zDir
endif
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
NEW PAVE
POSITION E 0 N ($!<this.yLength.val> - $!
<this.plThick.val>) U 0
END
-- <3>
82
NEW PAVE
POSITION E $!<this.plThick.val> N ($!
<this.yLength.val> - $!<this.plThick.val>) U 0
END
-- <4>
NEW PAVE
POSITION E $!<this.plThick.val> N $!
<this.plThick.val> U 0
END
END
END
!!ce = !paneRefe
-- Copy Pane Along X-Direction
do !c from 1 to !xCopies.int()
skip if (!c.eq(!xCopies.int()) and !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
enddo
NEW PANE COPY $!<paneRefe> BY X ($!<this.xLength.val>
- $!<this.plThick.val>) WRT CE
-- End Plate 1
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N 0 U 0
END
-- <2>
NEW PAVE
POSITION E $!<this.xLength.val> N 0 U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
-- <4>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
END
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
-- Bar Section
!spref = '/DESPAR-SPEC/Tube_with_design_parameters'
!possOffset = !this.gratingPos.val.offset(!yDir,!
83
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
this.rBarDia.val / 2))
!poseOffset = !possOffset.offset(!xDir,!
this.xLength.val)
NEW SCTN
!sctnRefe = !!ce
SPREF $!<spref>
DESP $!<this.rBarDia.val> ($!<this.rBarDia.val> /
2)
JUS NA
POSS $!<possOffset>
POSE $!<poseOffset>
DRNS PERP
DRNE PERP
END
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
enddo
if ((!yRemainder.real() * !this.pitchYdir.val) gt 10)
then
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
endif
END
-- Terminate Undo
!undoAble.endundoable()
AID CLEAR ALL $!<this.aidNumGrating>
endmethod
define method .dismiss()
AID CLEAR ALL $!<this.aidNumGrating>
!this.hide()
endmethodsetup form !!createGrating dialog dock
!this.formtitle = 'Create Structural Grating'
!this.cancelcall = '!this.dismiss()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
this.aidGratingBox()' width 7.5 is REAL format !!distanceFmt
text .yLength 'Y-Length' tagwidth 9 anchor
top+left+right callback '!this.aidGratingBox()' width 8 is
REAL format !!distanceFmt
line .barLenth anchor top+right vertical height 1
button .pickDimensions anchor top+right callback '!
this.pickDimensions()' pixmap height 16 width 16
button .interChange anchor top+right callback '!
this.interChange()' pixmap height 20 width 20
exit
path down
frame .plateframe 'Plate / Bar Dimensions' at
xmin.lengthframe anchor top+left+right width.lengthframe
text .plHeight 'Plate Height' tagwidth 9 callback '!
84
this.aidGratingBox()' width 5 is REAL format !!boreFmt
path right
text .plThick 'Plate Thick' tagwidth 8 width 5 is REAL
format !!boreFmt
text .rBarDia 'R-Bar Dia.' anchor top+left+right
tagwidth 8 width 5 is REAL format !!boreFmt
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
text .pitchXdir 'Pitch X-Direction' tagwidth 12 width
9 is REAL format !!distanceFmt
path right
text .pitchYdir 'Pitch Y-Direction' anchor
top+left+right tagwidth 12 width 9.25 is REAL format !!
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
width.lengthframe height 4
text .gratingPos 'Position' tagwidth 9 callback '!
this.aidGratingBox()' anchor top+left+right width 31.5 is
POSITION
path right
button .pickPosition callback '!this.pickPosition()'
anchor top+right pixmap height 16 width 16
path down
text .orientation 'Orientation' at xmin.gratingPos
anchor top+left+right tagwidth 9 callback '!this.aidGratingBox
()' width 35 is ORIENTATION
exit
button .create 'Create' at xmin.lengthframe anchor
bottom+left callback '!this.create()' linklabel
path right
button .about '?' at xmax form-size anchor bottom+right
linklabel callback '$P <$!<this>> 2015 - Aurelio Peros
Hinampas'
member .packet is EDGPACKET
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
exit
define method .createGrating()
!this.pickDimensions.setTooltip('Pick Dimensions for X-
Length & Y-Length by EDG measure.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
!this.interChange.addPixmap(!!pml.getpathname
('rotsup.png'))
!this.interChange.setTooltip('Swap X-Length & Y-Length
Dimensions.')
!this.pickPosition.addPixmap(!!pml.getpathname
('xyz16.png'))
!this.pickPosition.setTooltip('Set Origin of Structural
85
Grating by EDG Graphical Pick.')
!this.create.setTooltip('Create Structural Grating.')
!this.about.setTooltip('2015 - Aurelio Peros Hinampas')
!this.aidNumGrating = !!aidNumbers.add('Grating Aid
Number')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
!this.rBarDia.val = 10
!this.pitchXdir.val = 40
!this.pitchYdir.val = 200
!this.gratingPos.val = object POSITION('E0 N0 U0')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
define method .interChange()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
-- Swap Dimensions
!this.xLength.val = !yLen
!this.yLength.val = !xLen
!this.aidGratingBox()
endmethod
define method .pickDimensions()
-- Clear Pick Position Array
!this.pickPosi.clear()
AID CLEAR ALL $!<this.aidNumGrating>
!this.packet.definePosition('Pick Dimensions for X-Length
& Y-Length.')
!this.packet.description = 'X-Length & Y-Length'
!this.packet.action = '!!
createGrating.pickDimensionsDone(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .pickDimensionsDone(!pickedData is
EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
-- Saved Picked Position to an Array
!this.pickPosi.append(!this.position)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
$!<this.pickPosi[1]>
if (!this.pickPosi.size().eq(2)) then
!!edgCntrl.remove(!this.packetDesc)
-- X-Length Dimension
!xLength = !this.pickPosi[1].east - !this.pickPosi
[2].east
!this.xLength.val = !xLength.abs()
86
-- Y-Length Dimension
!yLength = !this.pickPosi[1].north - !this.pickPosi
[2].north
!this.yLength.val = !yLength.abs()
-- Update Grating Origin
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
!midPosi.north = !this.pickPosi[2].north
-- Construct Y-Line to get Direction
!yLine = object LINE(!this.pickPosi[1], !midPosi)
-- Construct X-Line to get Direction
!xLine = object LINE(!midPosi, !this.pickPosi[2])
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
!this.orientation.val = Y is $!<yDire> and X is $!
<xDire>
!this.aidGratingBox()
endif
endmethod
define method .pickPosition()
!this.packet.definePosition('Pick Origin of Structural
Grating.')
!this.packet.description = 'Reference Point'
!this.packet.action = '!!createGrating.positionDone
(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .positionDone(!pickedData is EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
!!edgCntrl.remove(!this.packetDesc)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
define method .aidGratingBox()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
!zLen = !this.plHeight.val
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
!zDir = !this.orientation.val.zDir()
if (!zDir.string().split()[1].upcase().eq('U')) then
!zOri = !zDir
else
!zOri = !zDir.opposite()
endif
!boxPos = !this.gratingPos.val.offset(!xDir,!xLen /
87
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
-- Aid Box
AID CLEAR ALL $!<this.aidNumGrating>
AID TRANSLUCENCY 25
AID BOX NUMBER $!<this.aidNumGrating> AT $!<boxPos>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
AID TEXT NUMBER $!<this.aidNumGrating> 'Origin' AT $!
<this.gratingPos.val>
endmethod
define method .create()
!xCopies = (!this.xLength.val - !this.plThick.val) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
if (!!ce.type.eq('FRMW')) then
!frmwOwner = !!ce
else
!frmwOwner = !!dtbGetOwnerType(!!ce,'FRMW')
endif
if (!frmwOwner.unset()) then
return error 1 'Unable to find FRMW type for Grating
to be created with. Must create a FRMW first or CE must be in
or below FRMW.'
endif
if (!frmwOwner.isnamed) then
!ownerName = !frmwOwner.name
else
!ownerName = '/STRUCTURAL'
endif
do !num
if (!num.lt(10)) then
!sbfrName = !ownerName & '-GR-0' & !num
else
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
!!ce = !sbfrName.dbref()
enddo
-- Enable Undo
!undoAble = object UNDOABLE()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
!xDir = !this.orientation.val.xdir()
!yDir = !this.orientation.val.ydir()
!zDir = !this.orientation.val.zdir()
if (!zDir.string().split()[1].upcase().eq('D')) then
!sJus = 'UTOP'
88
!zOri = !zDir.opposite()
else
!sJus = 'UBOT'
!zOri = !zDir
endif
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
NEW PAVE
POSITION E 0 N ($!<this.yLength.val> - $!
<this.plThick.val>) U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.plThick.val> N ($!
<this.yLength.val> - $!<this.plThick.val>) U 0
END
-- <4>
NEW PAVE
POSITION E $!<this.plThick.val> N $!
<this.plThick.val> U 0
END
END
END
!!ce = !paneRefe
-- Copy Pane Along X-Direction
do !c from 1 to !xCopies.int()
skip if (!c.eq(!xCopies.int()) and !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
enddo
NEW PANE COPY $!<paneRefe> BY X ($!<this.xLength.val>
- $!<this.plThick.val>) WRT CE
-- End Plate 1
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N 0 U 0
89
END
-- <2>
NEW PAVE
POSITION E $!<this.xLength.val> N 0 U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
-- <4>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
END
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
-- Bar Section
!spref = '/DESPAR-SPEC/Tube_with_design_parameters'
!possOffset = !this.gratingPos.val.offset(!yDir,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
this.rBarDia.val / 2))
!poseOffset = !possOffset.offset(!xDir,!
this.xLength.val)
NEW SCTN
!sctnRefe = !!ce
SPREF $!<spref>
DESP $!<this.rBarDia.val> ($!<this.rBarDia.val> /
2)
JUS NA
POSS $!<possOffset>
POSE $!<poseOffset>
DRNS PERP
DRNE PERP
END
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
enddo
if ((!yRemainder.real() * !this.pitchYdir.val) gt 10)
then
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
endif
END
-- Terminate Undo
!undoAble.endundoable()
AID CLEAR ALL $!<this.aidNumGrating>
endmethod
90
define method .dismiss()
AID CLEAR ALL $!<this.aidNumGrating>
!this.hide()
endmethodsetup form !!createGrating dialog dock
!this.formtitle = 'Create Structural Grating'
!this.cancelcall = '!this.dismiss()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
this.aidGratingBox()' width 7.5 is REAL format !!distanceFmt
text .yLength 'Y-Length' tagwidth 9 anchor
top+left+right callback '!this.aidGratingBox()' width 8 is
REAL format !!distanceFmt
line .barLenth anchor top+right vertical height 1
button .pickDimensions anchor top+right callback '!
this.pickDimensions()' pixmap height 16 width 16
button .interChange anchor top+right callback '!
this.interChange()' pixmap height 20 width 20
exit
path down
frame .plateframe 'Plate / Bar Dimensions' at
xmin.lengthframe anchor top+left+right width.lengthframe
text .plHeight 'Plate Height' tagwidth 9 callback '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
path right
text .plThick 'Plate Thick' tagwidth 8 width 5 is REAL
format !!boreFmt
text .rBarDia 'R-Bar Dia.' anchor top+left+right
tagwidth 8 width 5 is REAL format !!boreFmt
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
text .pitchXdir 'Pitch X-Direction' tagwidth 12 width
9 is REAL format !!distanceFmt
path right
text .pitchYdir 'Pitch Y-Direction' anchor
top+left+right tagwidth 12 width 9.25 is REAL format !!
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
width.lengthframe height 4
text .gratingPos 'Position' tagwidth 9 callback '!
this.aidGratingBox()' anchor top+left+right width 31.5 is
POSITION
path right
button .pickPosition callback '!this.pickPosition()'
anchor top+right pixmap height 16 width 16
path down
text .orientation 'Orientation' at xmin.gratingPos
anchor top+left+right tagwidth 9 callback '!this.aidGratingBox
()' width 35 is ORIENTATION
exit
button .create 'Create' at xmin.lengthframe anchor
bottom+left callback '!this.create()' linklabel
91
path right
button .about '?' at xmax form-size anchor bottom+right
linklabel callback '$P <$!<this>> 2015 - Aurelio Peros
Hinampas'
member .packet is EDGPACKET
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
exit
define method .createGrating()
!this.pickDimensions.setTooltip('Pick Dimensions for X-
Length & Y-Length by EDG measure.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
!this.interChange.addPixmap(!!pml.getpathname
('rotsup.png'))
!this.interChange.setTooltip('Swap X-Length & Y-Length
Dimensions.')
!this.pickPosition.addPixmap(!!pml.getpathname
('xyz16.png'))
!this.pickPosition.setTooltip('Set Origin of Structural
Grating by EDG Graphical Pick.')
!this.create.setTooltip('Create Structural Grating.')
!this.about.setTooltip('2015 - Aurelio Peros Hinampas')
!this.aidNumGrating = !!aidNumbers.add('Grating Aid
Number')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
!this.rBarDia.val = 10
!this.pitchXdir.val = 40
!this.pitchYdir.val = 200
!this.gratingPos.val = object POSITION('E0 N0 U0')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
define method .interChange()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
-- Swap Dimensions
!this.xLength.val = !yLen
!this.yLength.val = !xLen
!this.aidGratingBox()
endmethod
define method .pickDimensions()
-- Clear Pick Position Array
!this.pickPosi.clear()
AID CLEAR ALL $!<this.aidNumGrating>
92
!this.packet.definePosition('Pick Dimensions for X-Length
& Y-Length.')
!this.packet.description = 'X-Length & Y-Length'
!this.packet.action = '!!
createGrating.pickDimensionsDone(!this.return[1])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
define method .pickDimensionsDone(!pickedData is
EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
-- Saved Picked Position to an Array
!this.pickPosi.append(!this.position)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
$!<this.pickPosi[1]>
if (!this.pickPosi.size().eq(2)) then
!!edgCntrl.remove(!this.packetDesc)
-- X-Length Dimension
!xLength = !this.pickPosi[1].east - !this.pickPosi
[2].east
!this.xLength.val = !xLength.abs()
-- Y-Length Dimension
!yLength = !this.pickPosi[1].north - !this.pickPosi
[2].north
!this.yLength.val = !yLength.abs()
-- Update Grating Origin
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
!midPosi.north = !this.pickPosi[2].north
-- Construct Y-Line to get Direction
!yLine = object LINE(!this.pickPosi[1], !midPosi)
-- Construct X-Line to get Direction
!xLine = object LINE(!midPosi, !this.pickPosi[2])
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
!this.orientation.val = Y is $!<yDire> and X is $!
<xDire>
!this.aidGratingBox()
endif
endmethod
define method .pickPosition()
!this.packet.definePosition('Pick Origin of Structural
Grating.')
!this.packet.description = 'Reference Point'
!this.packet.action = '!!createGrating.positionDone
(!this.return[1])'
!this.packetDesc = !this.packet.description
93
!!edgCntrl.add(!this.packet)
endmethod
define method .positionDone(!pickedData is EDGPOSITIONDATA)
!this.position.position('$!<pickedData.position>')
!!edgCntrl.remove(!this.packetDesc)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
define method .aidGratingBox()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
!zLen = !this.plHeight.val
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
!zDir = !this.orientation.val.zDir()
if (!zDir.string().split()[1].upcase().eq('U')) then
!zOri = !zDir
else
!zOri = !zDir.opposite()
endif
!boxPos = !this.gratingPos.val.offset(!xDir,!xLen /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
-- Aid Box
AID CLEAR ALL $!<this.aidNumGrating>
AID TRANSLUCENCY 25
AID BOX NUMBER $!<this.aidNumGrating> AT $!<boxPos>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
AID TEXT NUMBER $!<this.aidNumGrating> 'Origin' AT $!
<this.gratingPos.val>
endmethod
define method .create()
!xCopies = (!this.xLength.val - !this.plThick.val) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
if (!!ce.type.eq('FRMW')) then
!frmwOwner = !!ce
else
!frmwOwner = !!dtbGetOwnerType(!!ce,'FRMW')
endif
if (!frmwOwner.unset()) then
return error 1 'Unable to find FRMW type for Grating
to be created with. Must create a FRMW first or CE must be in
or below FRMW.'
endif
if (!frmwOwner.isnamed) then
!ownerName = !frmwOwner.name
else
94
!ownerName = '/STRUCTURAL'
endif
do !num
if (!num.lt(10)) then
!sbfrName = !ownerName & '-GR-0' & !num
else
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
!!ce = !sbfrName.dbref()
enddo
-- Enable Undo
!undoAble = object UNDOABLE()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
!xDir = !this.orientation.val.xdir()
!yDir = !this.orientation.val.ydir()
!zDir = !this.orientation.val.zdir()
if (!zDir.string().split()[1].upcase().eq('D')) then
!sJus = 'UTOP'
!zOri = !zDir.opposite()
else
!sJus = 'UBOT'
!zOri = !zDir
endif
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
NEW PAVE
POSITION E 0 N ($!<this.yLength.val> - $!
<this.plThick.val>) U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.plThick.val> N ($!
<this.yLength.val> - $!<this.plThick.val>) U 0
END
-- <4>
NEW PAVE
POSITION E $!<this.plThick.val> N $!
<this.plThick.val> U 0
END
95
END
END
!!ce = !paneRefe
-- Copy Pane Along X-Direction
do !c from 1 to !xCopies.int()
skip if (!c.eq(!xCopies.int()) and !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
enddo
NEW PANE COPY $!<paneRefe> BY X ($!<this.xLength.val>
- $!<this.plThick.val>) WRT CE
-- End Plate 1
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
SJUSTIFICATION $!<sJus>
-- <1>
NEW PAVE
POSITION E 0 N 0 U 0
END
-- <2>
NEW PAVE
POSITION E $!<this.xLength.val> N 0 U 0
END
-- <3>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
-- <4>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
END
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
-- Bar Section
!spref = '/DESPAR-SPEC/Tube_with_design_parameters'
!possOffset = !this.gratingPos.val.offset(!yDir,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
this.rBarDia.val / 2))
!poseOffset = !possOffset.offset(!xDir,!
this.xLength.val)
NEW SCTN
!sctnRefe = !!ce
SPREF $!<spref>
DESP $!<this.rBarDia.val> ($!<this.rBarDia.val> /
2)
96
JUS NA
POSS $!<possOffset>
POSE $!<poseOffset>
DRNS PERP
DRNE PERP
END
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
enddo
if ((!yRemainder.real() * !this.pitchYdir.val) gt 10)
then
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
endif
END
-- Terminate Undo
!undoAble.endundoable()
AID CLEAR ALL $!<this.aidNumGrating>
endmethod
define method .dismiss()
AID CLEAR ALL $!<this.aidNumGrating>
!this.hide()
endmethod
97