AM, PDMS FORM

AM, PDMS PML 2021. 12. 13. 22:45

AM, PDMS FORM

 

아래와 같이 FORM을 만들고 name.pmlfrm 저장을 하면 됩니다.

그리고 AVEVA 설치된 경로에 pml.index 찾아서 form (name.pmlfrm) 경로를 입력해야 합니다.

이렇게 해야지 form 불러올수가 있습니다. 아니면 form의 위치를 다 입력해야 실행이 됩니다.

AM(pdms)의 command window에 show !!formname 입력후 엔터


setup form !!formname
	!this.formTitle = 'Form name'
	button .btnname at x 0 y 0 'name'  callback '!this.name()' background 8
exit

define method .name()
	!name = !!ce.name
    $p $!name
endmethod

'AM, PDMS PML' 카테고리의 다른 글

AM, PDMS CLIPPING  (3) 2021.05.30
AM PDMS EDGPACKET - EQUI MOVE  (0) 2021.05.20
AM, PDMS CE VOLUME CHECK  (0) 2021.05.10
AM, PDMS SESSION으로 HISTORY 보기  (0) 2021.02.25
AM, PDMS LINE OBJECT  (0) 2021.02.17
Posted by agape93
,

AM, PDMS CLIPPING

AM, PDMS PML 2021. 5. 30. 23:02

AM, PDMS CLIPPING

 

aid clear all

!rangeplus = 100
!modelref = !!ce

-- ce volume check
!vol = object volume(!!ce)

-- from Position
!volFrom = !vol.from
!volFromX = !volFrom.east
!volFromY = !volFrom.north
!volFromZ = !volFrom.up

-- to Position
!volTo = !vol.to
!volToX = !volTo.east
!volToY = !volTo.north
!volToZ = !volTo.up

!xlen = abs(!volFromX - !volToX)
!ylen = abs(!volFromY - !volToY)
!zlen = abs(!volFromZ - !volToZ)

-- center position
!cenpoint = !volFrom.midpoint(!volTo)

-- Geometrical Box
!box = object gmfbox()
!box.orientation = object orientation('Z is UP')
!box.position = !cenpoint

-- aid box
!xlen = !xlen + !rangeplus
!ylen = !ylen + !rangeplus
!zlen = !zlen + !rangeplus
aid box num 1 at $!cenpoint xlen $!xlen ylen $!ylen zlen $!zlen filled off

-- length
!box.xLength = !xlen
!box.yLength = !ylen
!box.zLength = !zlen

-- volume
!clipVol = object volume(!box)
!!gphViews.clipboxElement(!!gph3ddesign1.view, !clipVol)
!!gphviews.rotate(!!gph3ddesing1.view, !box.position )

-- aid text
!clipVolFrom = !clipVol.from
!clipVolTo = !clipVol.to
!clipVolPos[1] = !clipVolFrom
!clipVolPos[2] = !clipVolTo

-- ship grid
!shipGrid = object shipGrid()
do !p index !clipVolPos
	!shipPosition = !shipGrid.shipGridPosition(!clipVolPos[$!p])
	!shipPos[1] = !shipPosition.xPrefix  & ' ' & !shipPosition.xGridLine & ' +' & (!shipPosition.xoffset.value().string('d2'))
	!shipPos[2] = !shipPosition.yPrefix  & ' ' & !shipPosition.yGridLine & ' +' & (!shipPosition.yoffset.value().string('d2'))
	!shipPos[3] = !shipPosition.zPrefix  & ' ' & !shipPosition.zGridLine & ' +' & (!shipPosition.zoffset.value().string('d2'))
	!shipPos[3] = !clipVolPos[$!p].up.value().string('d2')
	!shipPos[1] = !shipPos[1].replace('+-','-')
	!shipPos[2] = !shipPos[2].replace('+-','-')
	!shipPos[3] = !shipPos[3].replace('+-','-')
	!br = '
'
	!grids[$!p] = |$!shipPos[1], $!shipPos[2] $!br $!shipPos[3] ($!shipPos[4])|
enddo

aid text '$!grids[1]' at $!clipVolFrom
aid text '$!grids[2]' at $!clipVolTo

'AM, PDMS PML' 카테고리의 다른 글

AM, PDMS FORM  (0) 2021.12.13
AM PDMS EDGPACKET - EQUI MOVE  (0) 2021.05.20
AM, PDMS CE VOLUME CHECK  (0) 2021.05.10
AM, PDMS SESSION으로 HISTORY 보기  (0) 2021.02.25
AM, PDMS LINE OBJECT  (0) 2021.02.17
Posted by agape93
,

AM PDMS EDGPACKET - EQUI MOVE

 

-- form
	member .equipos is array
	member .moveitem is dbref
	
define method .pickmove()
	$p >>> Click From Position
	!this.equipos = array()
	!packet = object EDGPACKET()
	!packet.definePosition('Pick position ESC to Finish')
	!packet.key = 'POS3D'
	!packet.type = 'POS3D'
	!packet.description = 'Pick Positioning'
	!packet.priority = 1
	!packet.remove = false
	!packet.action = '!!equimove.setmove(!this.return[1])'
	!packet.action = '!!equimove.endmove()'
	!!edgcntrl.add(!packet)
	!!edgposcntrl.setpic(7)
	!!edgposcntrl.setpicktype(7)
endmethod

define method .setmove(!pickdata is edgpositiondata)
	!pickitem = !pickdata.item
	!pickpos = !pickdata.position
	!pickpos = !pickpos.wrt(world)
	!this.equipos.append(!pickpos)
	
	if !this.equipos.size().eq(1) then
		$p >>> Click To Position
		!this.moveitem = !pickitem
	elseif !this.equipos.size().eq(2) then
		$p >>> Press ESC
	else
		!this.equipos[2].delete()
		!this.equipos.compress()
		$p >>> Press ESC
	endif
	
	aid clear text all
	do !p index !this.equipos
		aid text '$!p' at $!this.equipos[$!p]
	enddo
endmethod

define .endmove()
	aid clear text all
	!tempsn = !this.equipos.size()
	if !tempsn.eq(2) then
		--
	else
		$p >>> reselect
		return
	endif
	
	if !this.moveitem.owner.type.neq('EQUI') then
		$p >>> reselect item
		return
	endif
	
	$!this.moveitem.owner
	!xmove = !this.equipos[2].east - !this.equipos[1].east
	!ymove = !this.equipos[2].north - !this.equipos[1].north
	!zmove = !this.equipos[2].up - !this.equipos[1].up
	
	!movedir = !this.equipos[1].direction(!this.equipos[2])
	by x $!xmove
	by y $!ymove
	by z $!zmove
	$p >>> x,y,z move end~~~
endmethod

'AM, PDMS PML' 카테고리의 다른 글

AM, PDMS FORM  (0) 2021.12.13
AM, PDMS CLIPPING  (3) 2021.05.30
AM, PDMS CE VOLUME CHECK  (0) 2021.05.10
AM, PDMS SESSION으로 HISTORY 보기  (0) 2021.02.25
AM, PDMS LINE OBJECT  (0) 2021.02.17
Posted by agape93
,

선택 모델 VOLUME CHECK

-- ce volume check
!vol = object volume(!!ce)

-- from Position
!volFrom = !vol.from
!volFromX = !volFrom.east
!volFromY = !volFrom.north
!volFromZ = !volFrom.up

-- to Position
!volTo = !vol.to
!volToX = !volTo.east
!volToY = !volTo.north
!volToZ = !volTo.up

!xlen = abs(!volFromX - !volToX)
!ylen = abs(!volFromY - !volToY)
!zlen = abs(!volFromZ - !volToZ)

-- center position
!midpos = !volFrom.midpoint(!volTo)
pin1 at $!midpos
aid box num 1 at $!midpos xlen $!xlen ylen $!ylen zlen $!zlen filled off

-- volume 으로 간섭 체크
add all within vol ce (dist) - 화면에 추가
var !list coll all within vol ce (dist) - 리스트에 추가
q var !list - 리스트 출력

'AM, PDMS PML' 카테고리의 다른 글

AM, PDMS CLIPPING  (3) 2021.05.30
AM PDMS EDGPACKET - EQUI MOVE  (0) 2021.05.20
AM, PDMS SESSION으로 HISTORY 보기  (0) 2021.02.25
AM, PDMS LINE OBJECT  (0) 2021.02.17
AM, PDMS MARINE DRAFTING에서 DWG OPEN  (0) 2021.02.02
Posted by agape93
,

SESSION으로 HISTORY 보기

 

AM, PDMS 모델에서 마지막으로 수정한 USER을 알아보려면
Q USERM
그리고 마지막으로 수정한 일자를 보려면
Q LASTM

 

아래 내용은 모델의 수정한 USER와 수정한 일자를 모두 볼 수 있다

var !clockStr CLOCK
!clockArr = !clockStr.split()
  
if (!!module().appName.trim().upCase() neq 'ADMIN') then
	!dbName = !!ce.wdbName
else
	!dbName = 'None'
endif  

var !sessDnum SESSION ON $!clockArr[4]  $!clockArr[1] $!clockArr[2] $!clockArr[3]
!sessDnumReal = !sessDnum.real()
!sessMax = !sessDnumReal

!hist = history
$P <<<<< history >>>>>
$P =====================================

do !num from 0 to $!sessmax by 1
	do !h index !hist
		if !hist[$!h].eq(!num) then
			var !sessDate SESSDATE $!Num
			var !sessUserStr SESSUSER  $!Num
			var !sessC SESSCOMMENT -1    
			$p  Number: < $!num > 
			$p  user : < $!sessUserStr > / date : < $!sessDate >  
			$P =====================================
		endif
	enddo
enddo

참고 : https://section.cafe.naver.com/

'AM, PDMS PML' 카테고리의 다른 글

AM PDMS EDGPACKET - EQUI MOVE  (0) 2021.05.20
AM, PDMS CE VOLUME CHECK  (0) 2021.05.10
AM, PDMS LINE OBJECT  (0) 2021.02.17
AM, PDMS MARINE DRAFTING에서 DWG OPEN  (0) 2021.02.02
AM, PDMS REPORT  (0) 2021.01.06
Posted by agape93
,

AM, PDMS LINE OBJECT

AM, PDMS PML 2021. 2. 17. 21:21

LINE OBJECT

 

!pos = array()
!line = object line()
!dir = object direction()

var sctnlist collect all sctn for ce

do !s index !sctnlist
	-- 시작점과 끝점을 저장
	!poss = poss of $!sctnlist[$!s] wrt /*
	!pose = pose of $!sctnlist[$!s] wrt /*
	!pos.append(!poss)
	!pos.append(!pose)
	
	!linetemp = object line(!poss, !pose)
	!linedir = !linetemp.direction()
    
	-- aid number, line type ( 1:solid, 2:dashed, 3:dotted ), color 지정
	!linetemp.draw(101,1,7)
    
	-- DIR 비교
	if !dir.unset() then
		!dir = !linedir
	else
		-- 두개의 방향이 같으면 1, 직각이면 0, 반대면 -1
		!dirchk = !dir.dot(!linedir)
		handle any
		endhandle
		-- 다음 sctn 방향과 비교하기 위해 저장
		!dir = !linedir
	endif
    
	-- LINE 합치기
	if !line.unset() then
		!line = !linetemp
	else
		!line = !line.union(!linetemp)
		handle any
		endhandle
	endif
    
	-- 연장선상에 있는지 확인
	if !s.gt(1) then
		-- LINE 선상에서 POS와 가장 가까운 위치
		!nearposs = !line.near(!poss)
		if !poss.eq(!nearposs) then
			$p >>> poss ok
		endif
		
		!nearpose= !line.near(!pose)
		if !pose.eq(!nearpose) then
			$p >>> pose ok
		endif
	endif
enddo

-- POS 중 큰값과 작은값 사이의 거리
!posmax = !pos[!pos.sortedindices().last()]
!posmin = !pos[!pos.sortedindices().first()]
!dist = !posmax.distance(!posmin)

참고 : https://section.cafe.naver.com/

'AM, PDMS PML' 카테고리의 다른 글

AM, PDMS CE VOLUME CHECK  (0) 2021.05.10
AM, PDMS SESSION으로 HISTORY 보기  (0) 2021.02.25
AM, PDMS MARINE DRAFTING에서 DWG OPEN  (0) 2021.02.02
AM, PDMS REPORT  (0) 2021.01.06
AM, PDMS 명령어  (1) 2021.01.05
Posted by agape93
,

MARINE DRAFTING에서 DWG OPEN

 

 

-- form
toggle .ckdwgopen 'DwgOpen' at xmax +1 ymin

-- method
import 'marAPI'
handle any
endhandle

using namespace 'Aveva.Marine.Drafting'
!Drafting = object MARDRAFTING()

!opensheet = '/dwg_sheet'

-- 체크되어 있으면
if !this.ckdwgopen.val.eq(true) then
	!chkshee = !Drafting.Dwgcurrent()
	-- 도면이 열려있으면
	if !chkshee then
		-- 저장
		!Drafting.DwgSave()
		-- 닫기
		!Drafting.DwgClose()
		handle any
			-- 오류 발생시
			!message = 'Close Sheet Error'
			return error 1 '$!message'
		endhandle
	endif
    
	-- 도면 열기
	!Drafting.DwgOpen(!opensheet)
	handle any
		!Drafting.DwgClose()
		handle any
			!message = 'Open Sheet Error'
			return error 1 '$!message'
		elsehandle none
			-- 문제 없을때
			!Drafting.DwgOpen(!opensheet)
			handle any
				!!alert.error('Open Sheet Error')
				return
			endhandle
		endhandle
	endhandle
endif

'AM, PDMS PML' 카테고리의 다른 글

AM, PDMS CE VOLUME CHECK  (0) 2021.05.10
AM, PDMS SESSION으로 HISTORY 보기  (0) 2021.02.25
AM, PDMS LINE OBJECT  (0) 2021.02.17
AM, PDMS REPORT  (0) 2021.01.06
AM, PDMS 명령어  (1) 2021.01.05
Posted by agape93
,

CPU & MEMORY 사용량

private void btn_process_Click(object sender, EventArgs e)
{
    //timer 추가 하여 1초마다 update
    timer1.Interval = 1000;
    timer1.Start();
    GetProcess();
}

public void GetProcess()
{
    //Process 정보
    ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_PerfFormattedData_PerfProc_Process");

    //DataTable 생성
    DataTable table = new DataTable();
    table.Columns.Add("Name", typeof(object));
    table.Columns.Add("CPU(%)", typeof(double));
    table.Columns.Add("Memory(M)", typeof(double));
    table.Columns.Add("ProcessID", typeof(object));
    table.Columns.Add("Handles", typeof(object));
    table.Columns.Add("Threads", typeof(object));

    //CPU 개수
    int cpusn = Environment.ProcessorCount;
    
    try
    {
        foreach (ManagementObject queryObj in searcher.Get())
        {
            //CPU - dataGridView에서 정렬 가능하도록
            var name = queryObj.GetPropertyValue("Name");
            string cputemp = queryObj.GetPropertyValue("PercentProcessorTime").ToString();
            double cpu = double.Parse(cputemp) / cpusn;
            cputemp = string.Format("{0:N2}", cpu);
            cpu = double.Parse(cputemp);
            //memory - dataGridView에서 정렬 가능하도록
            string memorytemp = queryObj.GetPropertyValue("WorkingSetPrivate").ToString();
            double memory = double.Parse(memorytemp) / 1024 / 1024;
            memorytemp = string.Format("{0:N2}", memory);
            memory = double.Parse(memorytemp);
            
            var process = queryObj.GetPropertyValue("IDProcess");
            var handle = queryObj.GetPropertyValue("HandleCount");
            var thread = queryObj.GetPropertyValue("ThreadCount");

            table.Rows.Add(name, cpu, memory, process, handle, thread);
        }
    }
    catch (Exception ex)
    {
        //MessageBox.Show(ex.ToString());
    }

    //cpu 기준으로 정렬
    table.DefaultView.Sort = "CPU(%) DESC";
    //dataGridView에 입력
    dataGridView1.DataSource = table;

    try
    {
        //txt 저장
        StreamWriter SW;
        SW = File.CreateText(@"d:\temp\test.txt");
        foreach (ManagementObject queryObj in searcher.Get())
        {
            SW.Write("Name: {0} ", queryObj["Name"]);
            SW.Write("ProcessID: {0} ", queryObj["IDProcess"]);
            SW.Write("Handles: {0} ", queryObj["HandleCount"]);
            SW.Write("Threads: {0} ", queryObj["ThreadCount"]);
            SW.Write("Memory: {0} ", queryObj["WorkingSetPrivate"]);
            SW.WriteLine("CPU%: {0}", queryObj["PercentProcessorTime"]);
        }
        SW.Close();
    }
    catch (Exception ex)
    {
        //MessageBox.Show(ex.ToString());
    }
    
}

//timer 이용하여 강제 버튼 크릭 (1초마다 update)
private void timer1_Tick(object sender, EventArgs e)
{
  	btn_process.PerformClick();
}

참고 : https://duongame.tistory.com/356

Posted by agape93
,