달력

82025  이전 다음

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
procedure(formFieldDynamic()
let( (fieldHeight addField fieldBase)
	fieldHeight = 20
	addField = list(
		hiCreateButton(
			?name 'addField 
			?buttonText "ADD ITEM" 
			?callback "formFieldDynamic_add()" 
		)
		0:0 500:fieldHeight)
	fieldBase = list(
		hiCreateScrollRegion(
			?name 'fieldBase
			?scrollBars 'dynamic
		)
		0:50 500:100)

	hiCreateAppForm(
		?name 'formTest
		?formTitle "fomrTest"
		?fields list(
			addField
			fieldBase
		)
		?formType 'nonoptions
		?buttonLayout 'OKCancel
	) ; hiCreateAppForm

	formTest->idx = 1
	formTest->fieldHeight = fieldHeight
	hiDisplayForm(formTest)
)
)

procedure(formFieldDynamic_add()
let( (fieldHeight yLoc newField)
	fieldHeight = formTest->fieldHeight
	yLoc = length(formTest->fieldBase->fieldList) / 2 * fieldHeight
			
	newField = list(
		list(
			hiCreateButton(
				?name concat("field" formTest->idx)
				?buttonText sprintf(nil "field %d" formTest->idx)
				?callback sprintf(nil "printf(\"field%d clicked\n\")" formTest->idx) 
			)
			0:yLoc 200:fieldHeight)
		list(
			hiCreateButton(
				?name concat("delete" formTest->idx)
				?buttonText sprintf(nil "Delete %d" formTest->idx)
				?callback sprintf(nil "formFieldDynamic_delete(hiGetCurrentForm() %d)" formTest->idx)
			)
			220:yLoc 100:fieldHeight)
	)
	
	formTest->idx = formTest->idx + 1
	hiAddFields(formTest->fieldBase newField)
)
)

procedure(formFieldDynamic_delete(theForm idx)
let( ()
	hiDeleteFields(theForm->fieldBase list(concat("field" idx) concat("delete" idx)))
	
	formFieldDynamic_repositionFields(theForm->fieldBase)
)
)

procedure(formFieldDynamic_repositionFields(field @optional (fieldHeight 20))
let( (i idx maxIdx)
	i = 0
	idx = 0
	maxIdx = length(field->fieldList) - 1
	while(i <= maxIdx
		hiMoveField(field nth(i field->fieldList) 0:fieldHeight*idx)
		hiMoveField(field nth(i+1 field->fieldList) 220:fieldHeight*idx)
		idx++
		i = i + 2
	)
)
)
Posted by 이제웃자
|

Instance에 connectivity정보를 수동으로 입력 할 때 Connectivity -> Net -> Propagate Nets 메뉴를 사용한다. 그런데 instance에 terminal이 많이 존재하는 경우에는 입력 할 수 있는 form이 뜨는데 시간이 오래 걸림.


입력하고자 하는 connectivity정보가 단지 terminal이름과 같은 경우에는 이 form을 띄우지 않고 다음 예제와 같은 함수를 사용해서 선택한 instance에 빠르게 netName을 입력 할 수 있다.


procedure(propagateSelInst(
@optional 
	(curCV geGetEditCellView()) 
	(l_inst nil)
)
prog( (d_net)
	; 선택 한 instance 목록 만들기
	unless(l_inst l_inst = setof(x geGetSelSet(curCV) x~>isAnyInst) )
	
	foreach(d_inst l_inst
		; 기존 instTerms정보 삭제
		foreach(d_instTerm d_inst~>instTerms
			dbDeleteObject(d_instTerm)
		)
		
		; instance의 cellview내에서 terminal을 찾아 
		; 현재 레벨에 net생성 및 conn정보 생성
		foreach(term d_inst~>master~>terminals
			termName = term~>name
			
			d_net = dbFindNetByName(curCV termName)
			unless(d_net
				d_net = dbMakeNet(curCV termName)
			)
			
			; connection 정보를 생성한다.
			dbCreateConnByName(d_net d_inst termName)
		)
	)

	return(t)
)
)

'Programming > SKILL' 카테고리의 다른 글

form field를 동적으로 추가/삭제 하기  (0) 2020.03.29
내장함수 재정의  (0) 2019.02.24
유용하지만 자꾸 까먹는 함수 목록  (0) 2019.02.22
Posted by 이제웃자
|

기본적으로 내장함수는(ge*, hi*등) redefine이 금지되어 있음. 

이를 해제하기 위해서는 다음과 같이 사용하면 된다.

 

; 함수 재정의 금지 해제
sstatus(debugMode t)

; 기존 함수 
g_fn_leHiMove = getd('leHiMove)

; 변경하고자 하는 함수 정의
procedure(leHiMove()
let( ()
  ; 하고 싶은 동작
  printf("My leHiMove()\n")

  ; 기존 함수 실행
  apply(g_fn_leHiMove list())
)
)

; 함수 재정의 금지 적용
sstatus(debugMode nil)

 

Posted by 이제웃자
|

hiGetViewBBox()

윈도우에서 보여지는 영역의 좌표를 알고 싶은 경우 사용 할 수 있는 함수


dbGetAnyInstSwitchMaster()

instance의 master cell에 존재하는 view의 cellview을 얻을 때 유용하다. 쉽게 schematic에서 instance를 선택해서 schematic view의 cellview를 받아 올 때 유용.

schCV = dbGetAnyInstSwitchMaster(d_inst "schematic")


dbOpenCellViewByType() 함수를 사용 하는 것보다 수행시간이 더 빠름.

time = measureTime(
	d_inst = car(geGetSelSet())
	for(i 1 100000
		; Elapsed time : 2.356523 sec
		schCV = dbOpenCellViewByType(d_inst~>libName d_inst~>cellName d_inst~>viewName "" "r")
		
		; Elapsed time : 0.47401 sec
		;schCV = dbGetAnyInstSwitchMaster(d_inst "schematic")
	)
)

printf("Elapsed time : %L sec\n" nth(2 time))
Posted by 이제웃자
|