|
楼主 |
发表于 2014-9-25 18:09:20
|
显示全部楼层
本帖最后由 wangyan2059 于 2014-9-25 18:14 编辑
(hiSetBindKey "Layout" "<Key>F10" "textViewCoord()")
(procedure (textViewCoord)
(prog (cw cv selobjects selobj rang width number LabelName points x1 y1 x2 y2 offsetX offsetY)
(setq rang 2)
(setq cw (hiGetCurrentWindow))
(setq cv (geGetEditCellView))
(setq selobjects (geGetSelSet cv))
(setq myPort (outfile "/home/wangy/TEST_PROC/TxetCoordinate.txt"))
(fprintf myPort "pinName x y\n" )
(foreach selobj selobjects
(if (nequal selobj->objType "label") then
(geDeselectFig selobj))
);foreach
(foreach selobjL selobjects
(if (equal selobjL->objType "label") then
(setq LabelName selobjL->theLabel)
(setq layerLabel selobjL~>layerName)
(setq points selobjL~>xy)
(setq xCoordx (xCoord points))
(setq yCoordy (yCoord points))
(setq objects (gePointToFig (hiGetCurrentWindow) nil points))
(if (and (equal objects~>layerName layerLabel) (equal objects~>objType "path")) then
(setq points objects~>path)
(setq width (quotient objects~>width 2))
(setq number (difference objects~>nPoints 2))
(for number 0 number
(if (or (lessp (abs (difference yCoordy (yCoord (nth number points)))) width) (lessp (abs (difference xCoordx (xCoord (nth number points)))) width)) then
(setq x1 (abs (difference (xCoord (nth number+1 points)) (xCoord (nth number points))) ) )
(setq y1 (abs (difference (yCoord (nth number+1 points)) (yCoord (nth number points))) ) )
(if (greaterp x1 0.0001) then
(setq offsetY (difference (yCoord (nth number points)) yCoordy) )
else
(setq offsetY 0))
(if (greaterp y1 0.0001) then
(setq offsetX (difference (xCoord (nth number points)) xCoordx) )
else
(setq offsetX 0))
);endif
(postincrement number));endfor
);endif
(if (and (equal objects~>layerName layerLabel) (equal objects~>objType "rect")) then
(setq Box objects~>bBox)
(setq x2 (plus (abs (quotient (difference (xCoord (lowerLeft Box)) (xCoord (upperRight Box))) 2)) (xCoord (lowerLeft Box))) )
(setq y2 (plus (abs (quotient (difference (yCoord (lowerLeft Box)) (yCoord (upperRight Box))) 2)) (yCoord (lowerLeft Box))) )
(if (lessp (abs (difference xCoordx x2)) rang) then
(setq offsetX (difference x2 xCoordx)))
(if (lessp (abs (difference yCoordy y2)) rang) then
(setq offsetY (difference y2 yCoordy)))
);endif
(setq movePare (list (offsetXffsetY) "R0"))
(dbMoveFig selobjL, nil, movePare)
(setq points selobjL~>xy)
(setq xCoordx (xCoord points))
(setq yCoordy (yCoord points))
(fprintf myPort "%5s %.3f %.3f\n" LabelName xCoordx yCoordy)
);endif
);foreach
(close myPort)
);prog
);proce |
-
-
注意情况.zip
474 Bytes, 下载次数: 30
, 下载积分:
资产 -2 信元, 下载支出 2 信元
|