找回密码
 注册有问题进QQ群591484440

QQ登录

只需一步,快速开始

查看: 728|回复: 2

[有问必答] 柱网创建代码

[复制链接]

签到天数: 29 天

[LV.4]瞎扑签到4级

新手上路

积分
429
发表于 2015-5-8 17:24:06 | 显示全部楼层 |阅读模式
本帖最后由 sunqike1985 于 2015-5-8 20:14 编辑

setup form !!zgrid
  title 'Create Z-GridLines'

  text .CEName 'Gridlines' tagwidth 10 tooltip 'Select Subframework' width 20 is string
  button.CE1 'CE' at xmax+2 ymin width 7

  text .SBFR 'SBFR Name' tagwidth 10 at xmin.CEName ymax.CEName+0.2 tooltip 'New Structure' width 20 is string

  text .FRMWname 'FRMW Name' tagwidth 10 at xmin.SBFR ymax.SBFR+0.2 tooltip 'Select FRMW' width 20 is string
  button.CE2 'CE' at xmax+2 ymin width 7

  text .Height 'Z-Height' tagwidth 10 at xmin.FRMWname ymax.FRMWname+0.2 width 10 is string

  button.create 'Create' width 10 at xmin.Height ymax.Height+1
  button.Dis 'Dismiss' width 10 at xmax.create+20 ymin.create


  define method .zgrid()

  !this.ce1.callback = '!this.CE1()'
  !this.ce2.callback = '!this.CE2()'
  !this.create.callback = '!this.create()'

  endmethod

  define method .CE1()
  !this.CEName.val = !!ce.fullname
  !this.SBFR.val = !!ce.fullname + '/COLUMNS'
  endmethod

  define method .CE2()
  !this.FRMWname.val = !!ce.fullname
  endmethod

  define method .create()

    !NAME = !this.SBFR.VAL
        NEW SBFR $!NAME
        !HEIG = !THIS.Height.VAL
    !CONAME = !this.CEName.val
    !NAMES = !!collectAllFor('SCTN','TYPE EQ |SCTN|', !CONAME.DBREF())
        $p $!NAMES
    DO !i values !NAMES
        $p $!i
         --!refno = !i.refno.string()
         --!ele = !refno[!i]
         --!element = !ele
         !Gtype = !i.Dbref().Gtype
         --$P $!Gtype
          if (!Gtype eq 'XGRD' ) THEN
            !XPOS = X
                !ZPOS = Z
                !XNUM = NUMBER
                if(Gtype eq 'YGRD' ) THEN
                !YPOS = Y
                !YNUM = NUMBER
                NEW SCTN $!XNUM + '-' + $!YNUM
                POSS E$!XPOS Y$!YPOS Z$!ZPOS
                POSE E$!XPOS Y$!YPOS Z$!HEIG
                endif
         endif
          
        ENDDO

  endmethod
exit
最后那个create方法里有错误,从!NAMES那行开始,下面的那个循环只能取第一个refno,后面的都取不了,我不知道为什么,希望有会的大神帮忙给看看代码,谢谢了!

该用户从未签到

版主

积分
489
发表于 2015-5-9 07:31:02 | 显示全部楼层
你尝试把collectallfor换一种方法试试,如 var !NAMES coll all SCTN for $!CONAME
我反正在12.0sp6的帮助文档文档里面没有找到这个方法

点评

好的,我试试,谢了哥们  详情 回复 发表于 2015-5-9 08:48
回复 支持 反对

使用道具 举报

签到天数: 29 天

[LV.4]瞎扑签到4级

新手上路

积分
429
 楼主| 发表于 2015-5-9 08:48:47 | 显示全部楼层
随风 发表于 2015-5-9 07:31
你尝试把collectallfor换一种方法试试,如 var !NAMES coll all SCTN for $!CONAME
我反正在12.0sp6的帮助 ...

好的,我试试,谢了哥们
今天很开心!
回复 支持 反对

使用道具 举报

本版积分规则

QQ|手机版|关于我们|Archiver|手机版|小黑屋|工程G3D ( 鄂ICP备16022302号-2 )

GMT+8, 2024-5-2 04:52 , Processed in 0.375060 second(s), 32 queries .

Powered by Discuz! X3.5

Copyright © 2001-2024 Tencent Cloud.

快速回复 返回顶部 返回列表