-- 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
-- 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
$!<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,!
1
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
2
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')
3
!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
4
!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
5
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'
6
!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
7
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()
8
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
9
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.')
10
!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
11
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
12
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
13
-- 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>
14
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
15
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
16
!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
17
!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
18
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
19
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
20
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
21
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
22
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)
23
!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()
24
!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
25
-- 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
26
-- 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)
27
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 '!
28
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
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 '!
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 '!
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
29
!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
!this.gratingPos.val = !this.pickPosi[1]
30
-- 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>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
31
<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
NEW SBFR $!<sbfrName>
32
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>
NEW PAVE
33
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()'
34
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
member .position is POSITION
35
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])'
!this.packetDesc = !this.packet.description
36
!!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)
!this.gratingPos.val = !!createGrating.position
37
!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
!sbfrName = !ownerName & '-GR-' & !num
38
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 !
xRemainder.real().lt(0.5))
39
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
!!ce = !sctnRefe
40
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 !!
distanceFmt
41
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')
!this.orientation.val = object ORIENTATION('Y is N and Z
42
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])
43
-- 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) / !
this.pitchXdir.val
44
!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>
NEW PAVE
45
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
END
46
-- 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 $!
<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)
47
!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()
48
!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
49
-- 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
50
-- 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)
51
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 '!
52
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
53
!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>
54
!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
55
!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> - $!
56
<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
57
!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
58
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.')
59
!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
60
!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
61
!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()
62
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>
63
-- <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()
64
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
65
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()
66
-- 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'
67
!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
68
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
69
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
70
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
71
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')
72
!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
73
!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>
74
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
75
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>
76
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()'
77
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
78
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])'
79
!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)
80
!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
81
!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 !
82
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
83
!!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 !!
84
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')
85
!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])
86
-- 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) / !
87
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>
88
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
89
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
90
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.')
91
!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)
92
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
93
!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()
94
!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
95
!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>
96
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
97
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
98
!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
99
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')
100
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>
101
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,!
102
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 '!
103
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
104
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()
105
-- 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 /
106
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'
107
!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
108
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
109
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
110
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>
111
!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
112
!!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
113
!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
114
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)
115
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
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
116
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')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
117
!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
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
118
!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>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
119
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
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
120
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>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
121
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()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
122
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
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
123
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])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
124
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)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
125
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
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
126
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 !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
127
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
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
128
<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 !!
distanceFmt
exit
path down
129
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')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
130
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])
-- Update Grating Orientation
!yDire = !yLine.direction()
131
!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) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
132
!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>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
133
-- <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
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
134
- $!<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 $!
<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
135
!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()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
136
!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
-- Enable Undo
137
!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
-- End Plate 1
138
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)
then
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
139
<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 '!
this.aidGratingBox()' anchor top+left+right width 31.5 is
POSITION
140
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
!yLen = !this.yLength.val
-- Swap Dimensions
141
!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>
!this.aidGratingBox()
142
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
!frmwOwner = !!ce
else
143
!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> - $!
<this.plThick.val>) U 0
END
144
-- <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
!spref = '/DESPAR-SPEC/Tube_with_design_parameters'
145
!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
frame .plateframe 'Plate / Bar Dimensions' at
xmin.lengthframe anchor top+left+right width.lengthframe
146
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.')
!this.pickPosition.addPixmap(!!pml.getpathname
('xyz16.png'))
147
!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
!xLength = !this.pickPosi[1].east - !this.pickPosi
[2].east
148
!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
!zOri = !zDir.opposite()
endif
149
!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()
if (!zDir.string().split()[1].upcase().eq('D')) then
150
!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>
-- <1>
NEW PAVE
151
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()
AID CLEAR ALL $!<this.aidNumGrating>
endmethod
152
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
153
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()
-- Clear Pick Position Array
!this.pickPosi.clear()
154
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'
!this.packet.action = '!!createGrating.positionDone
(!this.return[1])'
155
!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
if (!frmwOwner.isnamed) then
!ownerName = !frmwOwner.name
156
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
POSITION E $!<this.plThick.val> N $!
<this.plThick.val> U 0
157
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
SPREF $!<spref>
DESP $!<this.rBarDia.val> ($!<this.rBarDia.val> /
158
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
exit
path down
159
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')
!this.xLength.val = 1200
!this.yLength.val = 1200
160
!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
!this.gratingPos.val = !this.pickPosi[1]
161
-- 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>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
162
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
NEW SBFR $!<sbfrName>
NEW PANE
163
!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>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
164
<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()'
frame .lengthframe 'Grating Dimensions' anchor
165
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
member .position is POSITION
member .pickPosi is ARRAY
166
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])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
167
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)
!this.gratingPos.val = !!createGrating.position
168
!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
!sbfrName = !ownerName & '-GR-' & !num
endif
169
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 !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
170
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
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
171
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 !!
distanceFmt
exit
172
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')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
173
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])
-- Update Grating Orientation
174
!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) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
175
!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>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
176
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
END
-- End Plate 2
177
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
button .pickDimensions anchor top+right callback '!
this.pickDimensions()' pixmap height 16 width 16
178
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.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
179
!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)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
180
$!<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
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
181
!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()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
182
!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
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
183
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>
endif
END
184
-- 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
button .pickPosition callback '!this.pickPosition()'
anchor top+right pixmap height 16 width 16
185
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
!this.yLength.val = !xLen
186
!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
endmethod
187
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')
endif
if (!frmwOwner.unset()) then
188
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>
NEW PAVE
POSITION E $!<this.plThick.val> N ($!
189
<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,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
this.rBarDia.val / 2))
190
!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 '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
path right
191
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
Grating by EDG Graphical Pick.')
!this.create.setTooltip('Create Structural Grating.')
192
!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()
-- Y-Length Dimension
!yLength = !this.pickPosi[1].north - !this.pickPosi
193
[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 /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
194
-- 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'
!zOri = !zDir.opposite()
else
195
!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
END
-- <2>
196
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
define method .dismiss()
AID CLEAR ALL $!<this.aidNumGrating>
197
!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
path right
button .about '?' at xmax form-size anchor bottom+right
198
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>
!this.packet.definePosition('Pick Dimensions for X-Length
199
& 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
!!edgCntrl.add(!this.packet)
endmethod
200
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
201
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
END
END
202
!!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)
JUS NA
POSS $!<possOffset>
203
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
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
text .pitchXdir 'Pitch X-Direction' tagwidth 12 width
204
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')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
!this.rBarDia.val = 10
205
!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
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
!midPosi.north = !this.pickPosi[2].north
206
-- 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>
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>
207
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
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
208
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>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
-- <4>
209
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()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
this.aidGratingBox()' width 7.5 is REAL format !!distanceFmt
210
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
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
exit
211
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
212
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)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
213
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
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
!!ce = !sbfrName.dbref()
214
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 !
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>
215
- $!<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
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
enddo
216
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 !!
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
width.lengthframe height 4
217
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')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
define method .interChange()
218
!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])
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
!this.orientation.val = Y is $!<yDire> and X is $!
219
<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) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
220
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>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
NEW PAVE
221
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
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
222
-- 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 $!
<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)
223
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
!xDir = !this.orientation.val.xDir()
224
!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()
!undoAble.description('Created Structural Grating.')
225
!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
!paneRefe = !!ce
226
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>
endif
227
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
button .pickPosition callback '!this.pickPosition()'
228
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
!this.yLength.val = !xLen
229
!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
endmethod
230
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')
endif
231
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>
NEW PAVE
232
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,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
233
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 '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
234
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
Grating by EDG Graphical Pick.')
235
!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()
-- Y-Length Dimension
236
!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 /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
237
-- 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'
!zOri = !zDir.opposite()
238
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
END
239
-- <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
define method .dismiss()
240
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
path right
241
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>
242
!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
!!edgCntrl.add(!this.packet)
243
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
!ownerName = '/STRUCTURAL'
244
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
END
245
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)
JUS NA
246
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
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
247
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')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
248
!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
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
249
!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>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
AID TEXT NUMBER $!<this.aidNumGrating> 'Origin' AT $!
250
<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
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
251
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>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
252
-- <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()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
253
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
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
254
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])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
255
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)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
256
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
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
257
!!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 !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
enddo
258
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
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
259
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 !!
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
260
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')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
261
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])
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
262
!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) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
263
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>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
264
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
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
265
-- 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
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
266
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.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
!this.interChange.addPixmap(!!pml.getpathname
('rotsup.png'))
267
!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)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
$!<this.pickPosi[1]>
if (!this.pickPosi.size().eq(2)) then
268
!!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
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
!zDir = !this.orientation.val.zDir()
if (!zDir.string().split()[1].upcase().eq('U')) then
269
!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()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
!xDir = !this.orientation.val.xdir()
270
!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
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
271
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>
endif
END
-- Terminate Undo
272
!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
button .pickPosition callback '!this.pickPosition()'
anchor top+right pixmap height 16 width 16
path down
text .orientation 'Orientation' at xmin.gratingPos
273
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()
endmethod
274
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()
!this.packet.definePosition('Pick Origin of Structural
275
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
to be created with. Must create a FRMW first or CE must be in
276
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
END
277
-- <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,!
this.xLength.val)
278
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
format !!boreFmt
279
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')
280
!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
!this.yLength.val = !yLength.abs()
281
-- 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
AID CLEAR ALL $!<this.aidNumGrating>
282
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'
!zOri = !zDir
283
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
POSITION E $!<this.xLength.val> N 0 U 0
284
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()
endmethodsetup form !!createGrating dialog dock
285
!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
Hinampas'
286
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.')
!this.packet.description = 'X-Length & Y-Length'
287
!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
define method .positionDone(!pickedData is EDGPOSITIONDATA)
288
!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
if (!num.lt(10)) then
289
!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
-- Copy Pane Along X-Direction
290
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>
DRNS PERP
291
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
path right
292
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
!this.pitchYdir.val = 200
293
!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
!yLine = object LINE(!this.pickPosi[1], !midPosi)
294
-- 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
295
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
HEIGHT $!<this.plHeight.val>
296
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
POSITION E 0 N $!<this.plThick.val> U 0
297
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
top+left+right callback '!this.aidGratingBox()' width 8 is
298
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
define method .createGrating()
299
!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)
!this.position.position('$!<pickedData.position>')
300
-- 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()
!xLen = !this.xLength.val
301
!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
302
-- 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
303
-- 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)
then
304
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 '!
this.aidGratingBox()' anchor top+left+right width 31.5 is
305
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
!yLen = !this.yLength.val
306
-- 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>
307
!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
!frmwOwner = !!ce
308
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> - $!
<this.plThick.val>) U 0
309
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
!spref = '/DESPAR-SPEC/Tube_with_design_parameters'
310
!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)
$!<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()
311
!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
312
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
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>
313
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()
AID CLEAR ALL $!<this.aidNumGrating>
314
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
exit
315
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()
-- Clear Pick Position Array
316
!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'
!this.packet.action = '!!createGrating.positionDone
317
(!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
if (!frmwOwner.isnamed) then
318
!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
POSITION E $!<this.plThick.val> N $!
319
<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
SPREF $!<spref>
320
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
exit
321
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')
!this.xLength.val = 1200
322
!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
!this.gratingPos.val = !this.pickPosi[1]
323
-- 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>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
324
<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
NEW SBFR $!<sbfrName>
325
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>
NEW PAVE
326
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()'
327
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
member .position is POSITION
328
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])'
!this.packetDesc = !this.packet.description
329
!!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)
!this.gratingPos.val = !!createGrating.position
330
!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
!sbfrName = !ownerName & '-GR-' & !num
331
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 !
xRemainder.real().lt(0.5))
332
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
!!ce = !sctnRefe
333
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 !!
distanceFmt
334
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')
!this.orientation.val = object ORIENTATION('Y is N and Z
335
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])
336
-- 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) / !
this.pitchXdir.val
337
!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>
NEW PAVE
338
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
END
339
-- 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
button .pickDimensions anchor top+right callback '!
340
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.')
!this.pickDimensions.addPixmap(!!pml.getpathname
341
('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)
342
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
!xDir = !this.orientation.val.xDir()
343
!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()
!undoAble.description('Created Structural Grating.')
344
!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
!paneRefe = !!ce
345
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>
endif
346
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
button .pickPosition callback '!this.pickPosition()'
347
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
!this.yLength.val = !xLen
348
!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
endmethod
349
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')
endif
350
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>
NEW PAVE
351
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,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
352
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 '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
353
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
Grating by EDG Graphical Pick.')
354
!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()
-- Y-Length Dimension
355
!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 /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
356
-- 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'
!zOri = !zDir.opposite()
357
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
END
358
-- <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
define method .dismiss()
359
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
path right
360
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>
361
!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
!!edgCntrl.add(!this.packet)
362
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
!ownerName = '/STRUCTURAL'
363
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
END
364
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)
JUS NA
365
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
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
366
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')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
367
!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
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
368
!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>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
AID TEXT NUMBER $!<this.aidNumGrating> 'Origin' AT $!
369
<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
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
370
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>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
371
-- <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()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
372
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
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
373
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])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
374
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)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
375
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
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
376
!!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 !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
enddo
377
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
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
378
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 !!
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
379
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')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
380
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])
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
381
!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) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
382
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>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
383
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
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
384
-- 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()
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
385
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')
!this.orientation.val = object ORIENTATION('Y is N and Z
386
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])
387
-- 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) / !
this.pitchXdir.val
388
!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>
NEW PAVE
389
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
END
390
-- 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
button .pickDimensions anchor top+right callback '!
391
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.')
!this.pickDimensions.addPixmap(!!pml.getpathname
392
('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)
393
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
!xDir = !this.orientation.val.xDir()
394
!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()
!undoAble.description('Created Structural Grating.')
395
!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
!paneRefe = !!ce
396
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 $!
<define method .interChange()
!xLen = !this.xLength.val
397
!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>
398
!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
399
!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> - $!
400
<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
401
!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
402
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.')
403
!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
404
!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
405
!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()
406
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>
407
-- <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()
408
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
409
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()
410
-- 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'
411
!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
412
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
413
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
414
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
415
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')
416
!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
417
!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>
418
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
419
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>
420
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()'
421
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
422
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])'
423
!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)
424
!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
425
!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 !
426
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
427
!!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 !!
428
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')
429
!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])
430
-- 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) / !
431
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>
432
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
433
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
434
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.')
435
!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)
436
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
437
!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()
438
!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
439
!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>
440
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
441
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
442
!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
443
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')
444
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>
445
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,!
446
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 '!
447
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
448
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()
449
-- 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 /
450
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'
451
!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
452
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
453
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
454
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>
455
!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
456
!!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
457
!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
458
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)
459
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
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
460
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')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
461
!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
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
462
!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>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
AID TRANSLUCENCY 0
463
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
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
464
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>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
465
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()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
466
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
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
467
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])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
endmethod
468
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)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
469
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
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
470
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 !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
CE
471
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
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
472
<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 !!
distanceFmt
exit
path down
473
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')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
474
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])
-- Update Grating Orientation
!yDire = !yLine.direction()
475
!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) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
476
!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>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
477
-- <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
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
478
- $!<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
button .pickDimensions anchor top+right callback '!
this.pickDimensions()' pixmap height 16 width 16
button .interChange anchor top+right callback '!
479
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.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
!this.interChange.addPixmap(!!pml.getpathname
480
('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)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
$!<this.pickPosi[1]>
481
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
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
!zDir = !this.orientation.val.zDir()
482
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()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
483
!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
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
484
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 $!
<define method .interChange()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
-- Swap Dimensions
485
!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>
!this.aidGratingBox()
486
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
!frmwOwner = !!ce
else
487
!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> - $!
<this.plThick.val>) U 0
END
488
-- <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
!spref = '/DESPAR-SPEC/Tube_with_design_parameters'
489
!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
frame .plateframe 'Plate / Bar Dimensions' at
xmin.lengthframe anchor top+left+right width.lengthframe
490
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.')
!this.pickPosition.addPixmap(!!pml.getpathname
('xyz16.png'))
491
!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
!xLength = !this.pickPosi[1].east - !this.pickPosi
[2].east
492
!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
!zOri = !zDir.opposite()
endif
493
!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()
if (!zDir.string().split()[1].upcase().eq('D')) then
494
!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>
-- <1>
NEW PAVE
495
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()
AID CLEAR ALL $!<this.aidNumGrating>
endmethod
496
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
497
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()
-- Clear Pick Position Array
!this.pickPosi.clear()
498
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'
!this.packet.action = '!!createGrating.positionDone
(!this.return[1])'
499
!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
if (!frmwOwner.isnamed) then
!ownerName = !frmwOwner.name
500
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
POSITION E $!<this.plThick.val> N $!
<this.plThick.val> U 0
501
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
SPREF $!<spref>
DESP $!<this.rBarDia.val> ($!<this.rBarDia.val> /
502
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
exit
path down
503
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')
!this.xLength.val = 1200
!this.yLength.val = 1200
504
!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
!this.gratingPos.val = !this.pickPosi[1]
505
-- 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>
ORIENTATION $!<this.orientation.val> XLEN $!<xLen> YLEN $!
<yLen> ZLEN $!<zLen> FILL ON
506
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
NEW SBFR $!<sbfrName>
NEW PANE
507
!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>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
508
<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()'
frame .lengthframe 'Grating Dimensions' anchor
509
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
member .position is POSITION
member .pickPosi is ARRAY
510
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])'
!this.packetDesc = !this.packet.description
!!edgCntrl.add(!this.packet)
511
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)
!this.gratingPos.val = !!createGrating.position
512
!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
!sbfrName = !ownerName & '-GR-' & !num
endif
513
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 !
xRemainder.real().lt(0.5))
NEW PANE COPY SAME BY X $!<this.pitchXdir.val> WRT
514
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
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
515
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 !!
distanceFmt
exit
516
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')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
517
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])
-- Update Grating Orientation
518
!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) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
519
!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>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
520
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
END
-- End Plate 2
521
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
button .pickDimensions anchor top+right callback '!
this.pickDimensions()' pixmap height 16 width 16
522
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.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
523
!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)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
524
$!<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
!xDir = !this.orientation.val.xDir()
!yDir = !this.orientation.val.yDir()
525
!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()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
526
!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
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
527
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>
endif
END
528
-- 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
button .pickPosition callback '!this.pickPosition()'
anchor top+right pixmap height 16 width 16
529
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
!this.yLength.val = !xLen
530
!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
endmethod
531
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')
endif
if (!frmwOwner.unset()) then
532
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>
NEW PAVE
POSITION E $!<this.plThick.val> N ($!
533
<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,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
this.rBarDia.val / 2))
534
!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 '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
path right
535
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
Grating by EDG Graphical Pick.')
!this.create.setTooltip('Create Structural Grating.')
536
!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()
-- Y-Length Dimension
!yLength = !this.pickPosi[1].north - !this.pickPosi
537
[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 /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
538
-- 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'
!zOri = !zDir.opposite()
else
539
!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
END
-- <2>
540
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
define method .dismiss()
AID CLEAR ALL $!<this.aidNumGrating>
541
!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
path right
button .about '?' at xmax form-size anchor bottom+right
542
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>
!this.packet.definePosition('Pick Dimensions for X-Length
543
& 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
!!edgCntrl.add(!this.packet)
endmethod
544
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
545
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
END
END
546
!!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)
JUS NA
POSS $!<possOffset>
547
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
exit
path down
frame .pitchframe 'Pitch Distance' at xmin.lengthframe
anchor top+left+right width.lengthframe
text .pitchXdir 'Pitch X-Direction' tagwidth 12 width
548
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')
!this.xLength.val = 1200
!this.yLength.val = 1200
!this.plHeight.val = 32
!this.plThick.val = 10
!this.rBarDia.val = 10
549
!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
!this.gratingPos.val = !this.pickPosi[1]
-- Y-Direction for Grating Orientation
!midPosi = !this.pickPosi[1]
!midPosi.north = !this.pickPosi[2].north
550
-- 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>
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>
551
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
NEW SBFR $!<sbfrName>
NEW PANE
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
552
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>
NEW PAVE
POSITION E $!<this.xLength.val> N $!
<this.plThick.val> U 0
END
-- <4>
553
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()'
frame .lengthframe 'Grating Dimensions' anchor
top+left+right
text .xLength 'X-Length' tagwidth 9 callback '!
this.aidGratingBox()' width 7.5 is REAL format !!distanceFmt
554
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
member .position is POSITION
member .pickPosi is ARRAY
member .packetDesc is STRING
member .aidNumGrating is REAL
exit
555
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
556
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)
!this.gratingPos.val = !!createGrating.position
!this.aidGratingBox()
endmethod
557
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
!sbfrName = !ownerName & '-GR-' & !num
endif
var !exists exists $!<sbfrName>
break if (!exists.eq('FALSEA'))
!!ce = !sbfrName.dbref()
558
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 !
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>
559
- $!<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
!!ce = !sctnRefe
do !b from 1 to !yCopies.int()
NEW SCTN COPY SAME MOVE $!<yDir> DISTANCE $!
<this.pitchYdir.val>
enddo
560
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 !!
distanceFmt
exit
path down
frame .oriposframe 'Position / Orientation' anchor all
width.lengthframe height 4
561
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')
!this.orientation.val = object ORIENTATION('Y is N and Z
is U')
endmethod
define method .interChange()
562
!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])
-- Update Grating Orientation
!yDire = !yLine.direction()
!xDire = !xLine.direction()
!this.orientation.val = Y is $!<yDire> and X is $!
563
<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) / !
this.pitchXdir.val
!yCopies = (!this.yLength.val / !this.pitchYdir.val) - 2
!xRemainder = '0.' & !xCopies.string('d2').after('.')
!yRemainder = '0.' & !yCopies.string('d2').after('.')
564
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>
NEW PAVE
POSITION E 0 N $!<this.plThick.val> U 0
END
-- <2>
NEW PAVE
565
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
END
-- End Plate 2
NEW PANE COPY $!<paneRefe> BY Y ($!<this.yLength.val>
- $!<this.plThick.val>) WRT CE
566
-- 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
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
567
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.')
!this.pickDimensions.addPixmap(!!pml.getpathname
('pickview16.png'))
!this.interChange.addPixmap(!!pml.getpathname
('rotsup.png'))
!this.interChange.setTooltip('Swap X-Length & Y-Length
568
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)
AID TEXT NUMBER $!<this.aidNumGrating> 'Start Measure' AT
$!<this.pickPosi[1]>
if (!this.pickPosi.size().eq(2)) then
!!edgCntrl.remove(!this.packetDesc)
569
-- 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
!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
570
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()
!undoAble.description('Created Structural Grating.')
!undoAble.add()
!xDir = !this.orientation.val.xdir()
!yDir = !this.orientation.val.ydir()
571
!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
!paneRefe = !!ce
POSITION $!<this.gratingPos.val>
ORIENTATION $!<this.orientation.val>
NEW PLOO
HEIGHT $!<this.plHeight.val>
572
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 $!
<define method .interChange()
!xLen = !this.xLength.val
!yLen = !this.yLength.val
-- Swap Dimensions
!this.xLength.val = !yLen
!this.yLength.val = !xLen
573
!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
endmethod
574
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')
endif
575
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>
NEW PAVE
576
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,!
this.pitchYdir.val).offset(!zOri,!this.plHeight.val - (!
577
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 '!
this.aidGratingBox()' width 5 is REAL format !!boreFmt
578
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
Grating by EDG Graphical Pick.')
579
!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()
-- Y-Length Dimension
580
!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 /
2).offset(!yDir,!yLen / 2).offset(!zOri,!zLen / 2)
581
-- 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'
!zOri = !zDir.opposite()
582
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
END
583
-- <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
define method .dismiss()
584
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
path right
585
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>
586
!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
!!edgCntrl.add(!this.packet)
587
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
!ownerName = '/STRUCTURAL'
588
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
END
589
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'
590