vivienluo 发表于 2013-4-14 21:36:48

将铜皮边框变为line源码分享

/****************************************************************/
/*               Command: ch_shape_to_line                  */
/*                  Author: VivienLuo                           */
/*                   Email: admin@allegro-skill.com             */
/*         Creation Date: 2013-02-21                        */
/*             Description: This Skill Function used to change*/
/*                        the shape to line.                  */
/****************************************************************/

axlCmdRegister("ch_shape_to_line" 'ch_shape_to_line ?cmdType "interactive"
                                 ?doneCmd 'shape2linedone ?cancelCmd 'shape2linecancel) ;registe command

procedure(ch_shape_to_line()
prog((selShape linePath lineLayer temp notdone )
      shape2linepopup = axlUIPopupDefine(nil (list
                                                (list "Done" 'shape2linedone )
                                                (list "Cancel" 'shape2linecancel ))
                                                )
      axlUIPopupSet(shape2linepopup)
      notdone = t
      axlUIWPrint(nil "------ Change Shape to Line V1.0 ---- Written By VivienLuo------")
      axlUIWPrint(nil "------ E-mail : admin@allegro-skill.com ------ February 21, 2013 ------")
      axlSetFindFilter(?enabled list("noall" "shapes") ?onButtons list("noall" "shapes"))
      shape2lineMark = axlDBTransactionStart()

      while(notdone
                axlClearSelSet()
                selShape = nil
                axlSingleSelectPoint()
                when(axlGetSelSet() != nil
                selShape = car(axlGetSelSet())
                linePath = axlPathStart(list(car(car(selShape->segments)->startEnd)))
                lineLayer = selShape->layer ;Gets Shape's Layer
                foreach(temp selShape->segments
                              case(temp->objType
                                        ("line"
                                                axlPathLine(linePath nil cadr(temp->startEnd))
                                                )
                                        ("arc"
                                                axlPathArcCenter(linePath nil cadr(temp->startEnd) temp->isClockwise temp->xy)
                                                )
                                        (t
                                                printf("Path Type is Unknown!\n")
                                                )
                              );end case                        
                )      
                axlHighlightObject(car(axlDBCreatePath(linePath lineLayer 'line)))
                axlDeleteObject(selShape)
                axlUIWPrint(nil "- Change Shape To Line Success! -")
                );end when
      );end while
)
);end procedure

procedure(shape2linedone()
                notdone = nil
                axlDBTransactionCommit(shape2lineMark)
                axlFinishEnterFun()
                axlUIWPrint(nil "- Done -")
)
procedure(shape2linecancel()
                notdone = nil
                axlDBTransactionRollback(shape2lineMark)
                axlCancelEnterFun()
                axlUIWPrint(nil "- Cancel -")
)

chuankay 发表于 2013-5-15 23:28:42

我认为铜皮边框可以用z-copy的方式将其生成outline的边框,然后删除铜皮,最后打散outline到需要的line层,也可达到效果。

vivienluo 发表于 2013-5-15 23:35:59

chuankay 发表于 2013-5-15 23:28 static/image/common/back.gif
我认为铜皮边框可以用z-copy的方式将其生成outline的边框,然后删除铜皮,最后打散outline到需要的line层, ...

呵呵,这样只是寻求一个快捷方式。

chuankay 发表于 2013-5-15 23:37:56

代码收藏了谢谢

vivienluo 发表于 2013-5-15 23:40:05

chuankay 发表于 2013-5-15 23:37 static/image/common/back.gif
代码收藏了谢谢

这个还有更简便的方式。可使用axlPolyFromDB函数直接获取shape边框。。。

chuankay 发表于 2013-5-16 12:25:09

vivienluo 发表于 2013-5-15 23:40 static/image/common/back.gif
这个还有更简便的方式。可使用axlPolyFromDB函数直接获取shape边框。。。

看来您对database cteate那一篇很熟悉,我也要补习了

xieh_17 发表于 2013-7-5 08:17:54

将铜皮变为line的功能,请问有哪些应用场景?outline一般都由结构给出的外形线来的,与铜皮有关系吗?

junshi1000 发表于 2014-7-5 00:16:37

不知楼主有没有可以让铜皮与线之间互相转换的SKILL供大家学习,谢谢:(:)

chuchiwolong 发表于 2014-7-31 15:08:22

Shape菜单里的Decompose Shape命令就可以实现这个功能啊

vivienluo 发表于 2014-7-31 17:08:31

chuchiwolong 发表于 2014-7-31 15:08
Shape菜单里的Decompose Shape命令就可以实现这个功能啊

Decompose Shape边的line在另外一层,二且是有一小段组成的。操作不方便。
页: [1] 2
查看完整版本: 将铜皮边框变为line源码分享