TA的每日心情 | 奋斗 2025-4-27 15:26 |
---|
签到天数: 81 天 [LV.6]常住居民II
|
好几年前写的,从一个skill里摘出来的,一直没优化过,不能直接使用,仅供参考。
- ;;添加高度信息
- procedure(_dbAddHeightInfo(heightClass myLayer)
- (let (i myHeight myRotation myOrient myOffset myCerter textHeight uFc tmp p)
- uFc = axlMKSConvert(1 "mils" car((axlDBGetDesignUnits)))
-
- axlVisibleDesign(nil) ;关闭视图
- axlVisibleLayer(strcat("PACKAGE GEOMETRY/PLACE_BOUND_" myLayer) t) ;打开层
- axlVisibleLayer(strcat(heightClass myLayer) t)
- axlVisibleUpdate(nil) ;显示生效
- axlClearSelSet() ;清空选择
- axlSetFindFilter(?enabled `("NOALL" "SHAPES") ?onButtons `("SHAPES"))
- axlAddSelectAll() ;选择所有shape
-
- /* p = axlGetParam("paramTextBlock:38") ;修改字体
- p->width = 20.0 * uFc
- p->height = 25.0 * uFc
- p->lineSpace = 1.0 * uFc
- p->photoWidth = 4.0 * uFc
- p->charSpace = 1.0 * uFc
- axlSetParam(p) */
-
- foreach(i axlGetSelSet() ;遍历shape
- when(i->parent ;过滤掉假shape
- myRotation = mod(round(i->parent->rotation) 180) ;方向信息转换归一
- when(myRotation == 135 myRotation = 315) ;135度单独处理
- textHeight = axlGetParam("paramTextBlock:2")->height ;得到字体信息
- myOffset = case(myRotation ;根据字体信息计算偏移;可以改成sin和cos,需要确认。
- (0 list(0 , - textHeight / 2))
- (90 list(textHeight / 2 , 0))
- (45 list(textHeight / 2.8285 , - textHeight / 2.8285))
- (315 list(- textHeight / 2.8285 , - textHeight / 2.8285))
- (t list(0 , 0))
- )
- myCerter = axlMXYAdd(trBBoxCenter(i->bBox) myOffset) ;根据偏移计算text的正中心
- myOrient = make_axlTextOrientation(?textBlock "2", ?rotation myRotation, ?mirrored nil, ?justify "center") ;选择字体
- if(tmp = i->prop->PACKAGE_HEIGHT_MAX then
- myHeight = atof(car(parseString(tmp))) / uFc * 25.4 / 1000 ;高度信息转换成毫米
- when(myHeight >= 1.0 ;高度大于该值才处理
- axlDBCreateText(sprintf(nil "%.2f" myHeight) myCerter myOrient strcat(heightClass myLayer)) ;创建Text
- )
- else
- axlDBCreateText("N/A" myCerter myOrient strcat(heightClass myLayer)) ;创建Text
- )
- )
- )
- axlClearSelSet()
- ))
复制代码
|
|