Without loading it and trying it I have to ask how much it would slow the graphics down? Most places I work at we use a single PANE with a correct MATREF for the grating spec to gain the weight, CofG etc. We then set the Grating in the AutoColour rules to have a 25% translucency so that it is obviously grating and not plating.
-- Mansyur Usman (mansyur.usm@gmail.com)
-- PML for Creating Grate for Structure
setup form !!mangrate size 37.5 15
Var !UserName Login
Var !UserName UpCase(|$!UserName|)
!THIS.FORMTITLE = 'Gratting Form for $!UserName'
path d
text .LX 'Panjang Gratting ' at 0 1 width 10 is REAL
text .LY 'Lebar Gratting ' at 0 2 width 10 is REAL
text .PW 'Tinggi Gratting ' at 0 3 width 10 is REAL
text .PT 'Tebal Plate ' at 0 4 width 10 is REAL
text .BSIZE 'Plate Horizontal ' at 0 5 width 10 is REAL
text .PX'Space Plate Horizontal' at 0 6 width 10 is REAL
text .PY'Space Plate Vertical ' at 0 7 width 10 is REAL
text .NM'Nama Plate' at 0 8 width 22 is STRING
frame .framepos 'Coordinat' at 0 9
button .create 'Create' at 0.5 1 callback '!this.kerjakan()' backg green
button .pickPos 'Position' at 23 1 callback '!this.pickPosition()' backg pink
text .position 'Pos' at 0 3 width 28 is string
!IntX = INT ($!LX / $!PX)
!IntY = INT ($!LY / $!PY)
NEW STRUC
NAME /'$!NM'
NEW SUBS
NEW BOX XLEN $!PT YLEN $!LY ZLEN $!PW
BY X ($!PT / 2) Y ($!LY / 2) Z ($!PW / 2)
DO !x FROM 1 TO ($!IntX - 1)
NEW BOX XLEN $!PT YLEN ($!LY - $!PT * 2) ZLEN $!PW
BY X ($!PX * $!x + $!PT / 2) Y ($!LY / 2) Z ($!PW / 2)
ENDDO
NEW BOX XLEN $!PT YLEN $!LY ZLEN $!PW
BY X ($!LX - $!PT / 2) Y ($!LY / 2) Z ($!PW / 2)
NEW BOX XLEN $!LX YLEN $!PT ZLEN $!PW
BY X ($!LX / 2) Y ($!PT / 2) Z ($!PW / 2)
DO !y FROM 1 TO ($!IntY - 1)
-- NEW BOX XLEN $!LX YLEN $!BSIZE ZLEN $!BSIZE
NEW CYLI DIA $!BSIZE HEI $!LX
ORI Y IS N AND Z IS E
BY X ($!LX / 2) Y ($!PY * $!y + $!PT / 2) Z ($!PW - $!BSIZE / 2)
ENDDO
NEW BOX XLEN $!LX YLEN $!PT ZLEN $!PW
BY X ($!LX / 2) Y ($!LY - $!PT / 2) Z ($!PW / 2)
SUBS
endmethod
define method .pickPosition()
-- Object Format to Control Decimal Precision.
!format = object format()
!format.dp = 1
prompt dismiss
prompt off
prompt load escape 'Identify Element as Reference Position...'
var !pick pick
handle any
prompt on
return
endhandle
prompt on
!dbref = !pick[1].dbref()
if (!dbref.hardtype.eq('SCTN') or !dbref.hardtype.eq('GENSEC')) then
-- Get a LINE that represents the Start & End.
!line = !dbref.pose.line(!dbref.poss)
-- Get a POINTVECTOR from the picked Element informations.
!pickPos = object position(!pick[2].after(|Through|))
!pickDir = object direction(!pick[2].after(|Line|).before(|Through|))
!pVector = object pointvector(!pickPos, !pickDir)
-- Derived the POSITION Picked along the SCTN.
!pickPos = !line.intersection(!pVector)
-- Get which is the Nearest (End or Start).
if (!dbref.poss.distance(!pickPos).leq(!dbref.pose.distance(!pickPos))) then
-- Position is at the START.
!panePos = !dbref.poss.wrt(world)
else
-- Position is at the END
!panePos = !dbref.pose.wrt(world)
endif
else
-- Position is at the Origin of the Picked Element.
!panePos = !dbref.position.wrt(world)
endif
-- Set Value to Position:
!this.position.val = !panePos.string(!format)
axes at $!panePos
endmethod