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(
)

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值