Skill交互函数
概述
接口函数主要是提供了显示控制,光标建立和人机交互.
- 动态光标函数:axlEnter
- popup动态交互函数:axlCancelEnterFun和axlFinishEnterFun;在循环换取路径时,可以使用这两个函数结束循环
- 高亮对象:axlHighlightObject和axlDehighlightObject
The two examples that follow show how to set up the dynamic cursor:
■ A package symbol image with pins connected to other etch, with rubberband lines from
its connected pins to the points where they had originally connected
■ A package symbol image dynamically rotating enabling you to select an angle of rotation
动态光标例程
Dynamic Rubberband
axlClearDynamics() ; Clean out any existing cursor data
; Create cross markers to show rubberband origins:
axlDBCreateLine(
list(9150:4450 9050:4550)
0.
"board geometry/dimension"
)
axlDBCreateLine(
list(9150:4550 9050:4450)
0.
"board geometry/dimension"
)
axlDBCreateLine(
list(8550:4450 8450:4550)
0.
"board geometry/dimension"
)
axlDBCreateLine(
list(8550:4550 8450:4450)
0.
"board geometry/dimension"
)
mypath = axlPathStart(list( -350:0)) ; Start circular pad
axlPathArcCenter(mypath, 0., -350:0, nil, -300:0)
; Load the first pad into the dynamic cursor buffer
axlAddSimpleMoveDynamics(0:0 mypath "path" ?ref_point 0:0)
mypath = axlPathStart(list( 350:0)) ; Start circular pad
axlPathArcCenter(mypath, 0., 350:0, nil, 300:0)
; Load the other pad into the dynamic cursor buffer
axlAddSimpleMoveDynamics(0:0 mypath "path" ?ref_point 0:0)
mypath = axlPathStart( ; Start resistor body outline
list( -200:-100 200:-100 200:100 -200:100 -200:-100))
; Load the resistor body outline in the dynamic cursor buf
axlAddSimpleMoveDynamics(0:0 mypath "path" ?ref_point 0:0)
; Load a "path" rubberband to the first pad
axlAddSimpleRbandDynamics(8500:4500 "path" ?origin 8500:4500 ?var_point -300:0)
; Load a "directline" rubberband to the second pad
axlAddSimpleRbandDynamics(9100:4500 "directline" ?origin 9100:4500 ?var_point 300:0)
;
mypoint = axlEnterPoint() ; Ask user for point
Dynamic Cursor Rotation
axlClearDynamics() ; Clean out any existing cursor data
mypath = axlPathStart(list( -350:0)) ; Start circular pad
axlPathArcCenter(mypath, 0., -350:0, nil, -300:0)
; Load the first pad into the dynamic cursor buffer
axlAddSimpleMoveDynamics(0:0 mypath "path" ?ref_point 0:0)
mypath = axlPathStart(list( 350:0)) ; Start circular pad
axlPathArcCenter(mypath, 0., 350:0, nil, 300:0)
; Load the other pad into the dynamic cursor buffer
axlAddSimpleMoveDynamics(0:0 mypath "path" ?ref_point 0:0)
mypath = axlPathStart( ; Start resistor body outline
list( -200:-100 200:-100 200:100 -200:100 -200:-100))
; Load the resistor body outline in the dynamic cursor buf
axlAddSimpleMoveDynamics(0:0 mypath "path" ?ref_point 0:0)
; Ask user to pick angle of rotation about (8500:4500):
axlEnterAngle(8500:4500)
Enter Function Example
(defun axlMyCancel ()
axlClearDynamics()
axlCancelEnterFun()
axlUIPopupSet(nil)
)
(defun axlMyDone ()
axlClearDynamics()
axlFinishEnterFun()
axlUIPopupSet(nil)
)
mypopup = axlUIPopupDefine(
nil
(list
(list "MyCancel" 'axlMyCancel)
(list "MyDone" 'axlMyDone)
)
)
axlUIPopupSet( mypopup)
; Clear the dynamic buffer
axlClearDynamics()
; Clear mypath to nil, then loop gathering user picks:
mypath = nil
while( (mypath = axlEnterPath(?lastPath mypath))
progn(
axlDBCreatePath(mypath, "etch/top")
)
)
axlHighlightObject and axlDehighlightObject Examples
(defun highlightLoop ()
mypopup = axlUIPopupDefine(
nil
(list
(list "Done" 'axlFinishEnterFun)
(list "Cancel" 'axlCancelEnterFun)
)
)
axlUIPopupSet( mypopup)
axlSetFindFilter(
?enabled '("noall" "alltypes" "nameform")
?onButtons "alltypes"
)
(while (axlSelect)
progn(
axlHighlightObject( axlGetSelSet())
; Just a dummy delay to see what happens
sum = 0
for( i 1 10000 sum = sum + i)
axlDBControl('highlightColor 4)
axlHighlightObject(axlGetSelSet() t)
)
)
函数解析
清理动态光标缓存
axlClearDynamics(
)
添加Rband到动态光标
axlAddSimpleRbandDynamics(
l_fixed_point
t_type ; path, directline, horizline, vertline, arc, circle, or box
?origin l_origin
?var_point l_var_point
?lastPath r_lastPath
)
逐次加载数据到动态光标缓存
axlAddSimpleMoveDynamics(
l_origin
r_path
t_type
?ref_point l_ref_point
)
获取点
axlEnterPoint(
?prompts l_prompts
?points l_points
?gridSnap g_gridSnap
)
axlEnterPoint( ?prompts "This is a axlEnterPoint" ?points nil ?gridSnap t )
获取字符串
axlEnterString(
?prompts l_prompts
)
axlEnterString( ?prompts "This is axlEnterString" )
获取Box
axlEnterBox(
?prompts l_prompts
?points l_points
) ⇒
l_box/nil
实例
; 返回由给定的两个点确定的Box
axlEnterBox( ?prompts "Enter Box" ?points (list 100:100 200:200) )
; 给定一个点100:100,由用户选择第二个点
axlEnterBox( ?prompts (list "Enter Box") ?points (list 100:100 ) )
; 由用户选择两个点,并返回有这两个点组成的Box
axlEnterBox( ?prompts (list "Enter Box") ?points nil )
获取角度
axlEnterAngle(
origin
?prompts l_prompts
?refPoint l_refPoint
?angle f_angle
?lockAngle g_lockAngle
)
defun(sgEnterDemo ()
while(axlEnterAngle(
0:0,
?prompts "This is axlEnterAngle",
?refPoint 0:0,
?angle nil,
?lockAngle 1 ; 角度精度
)
axlSleep(1)
)
)
终止用户等待
axlCancelEnterFun(
)
axlFinishEnterFun(
)