Adams session object
Adams session object 는 Adams Python interface 에서 Adams 클래스로 표현되는 현재 Adams 세션 자체를 가리키는 최상위 객체이다 [Adams_2023.1_Python_Interface_User_Guide.pdf p.11].
정의·용도
Adams 클래스는 Adams session object 를 나타내며, 이 클래스를 통해 model 을 생성(create)하거나 조회(lookup)할 수 있고, 현재 활성화된 model(current active model)을 얻을 수 있다 [Adams_2023.1_Python_Interface_User_Guide.pdf p.11].
세션은 사용자가 작업하는 단위 컨텍스트로서, 예를 들어 binary file 에서 entity 를 읽어들일 때 별도의 단위 정보가 없으면 default session units 가 적용되어 가져온 entity 의 attribute 가 현재 session units 로 올바르게 변환된다 [Adams_2024.1_Adams_View_Command_User_Guide.pdf p.530]. 또한 part create fe_part, force create fe_load 등 다수의 명령은 “in the Adams session” 단위로 entity 를 생성·수정한다 [Adams_2024.1_Adams_View_Command_User_Guide.pdf p.1795][Adams_2024.1_Adams_View_Command_User_Guide.pdf p.690].
형식 / 필드 / 구문
객체 생성은 특정 class 의 객체를 만들도록 설계된 “manager” 들이 담당하며, 모든 객체는 그 하위에 생성 가능한 객체 타입에 대한 manager handle 을 갖는다 [Adams_2023.1_Python_Interface_User_Guide.pdf p.12].
현재 세션에서 model 을 생성하는 명령은 다음과 같다 [Adams_2023.1_Python_Interface_User_Guide.pdf p.12]:
mod = Adams.Models.create() # 자동 생성된 이름으로 model 생성
mod = Adams.Models.create(name="MODEL3") # 지정한 이름으로 model 생성생성된 mod 는 방금 만든 model 의 python handle 이다. Model class 는 Part 객체 생성을 위한 manager handle 을 가지므로, 다음과 같이 RigidBody 타입 part 를 생성할 수 있다 [Adams_2023.1_Python_Interface_User_Guide.pdf p.12]:
p = mod.Parts.createRigidBody()여러 객체 타입을 지원하는 manager 는 각 class 별로 create<Class Name> 형식의 생성 메서드를 갖는다. Part manager 는 RigidBody, FlexibleBody, PointMass 를 지원하며 각각 createRigidBody, createFlexBody, createPointMass 메서드에 대응한다 [Adams_2023.1_Python_Interface_User_Guide.pdf p.12].
객체의 property 는 database 상의 Adams object attribute 에 매핑되며, 해당 descriptor 에 접근하여 설정·조회할 수 있다 [Adams_2023.1_Python_Interface_User_Guide.pdf p.13]:
p_PART_001.properties # 모델링 객체의 모든 property 조회
p_PART_001.adams_id = 19910 # Adams ID 설정
p_PART_001.adams_id # 설정값 확인 -> 19910사용 예
Adams View 시작 시 Python script 를 실행하는 방법은 두 가지가 있다 [Adams_2023.1_Python_Interface_User_Guide.pdf p.11]:
PYTHONSTARTUP환경변수를 python script 의 전체 경로로 지정하면, Adams View 실행 시aview.cmdstart up 파일 이후 해당 파일의 Python 명령이 실행된다. 이 파일은 대화형 명령과 동일한 namespace 에서 실행되므로 거기서 정의·import 한 Adams View 객체를 interactive session 에서 사용할 수 있다 [Adams_2023.1_Python_Interface_User_Guide.pdf p.11].- 작업 디렉터리의
aview.cmd파일에run_python_code를 호출하는 라인을 넣는 방법이다 [Adams_2023.1_Python_Interface_User_Guide.pdf p.11].
세션 활동 기록과 관련해서는, file log_file 로 생성되는 ASCII log_file 이 Adams View session 의 기록(record)이 된다 [Adams_2024.1_Adams_View_Command_User_Guide.pdf p.569].
관련 항목
출처
- [Adams_2023.1_Python_Interface_User_Guide.pdf p.11]
- [Adams_2023.1_Python_Interface_User_Guide.pdf p.12]
- [Adams_2023.1_Python_Interface_User_Guide.pdf p.13]
- [Adams_2024.1_Adams_View_Command_User_Guide.pdf p.530]
- [Adams_2024.1_Adams_View_Command_User_Guide.pdf p.569]
- [Adams_2024.1_Adams_View_Command_User_Guide.pdf p.690]
- [Adams_2024.1_Adams_View_Command_User_Guide.pdf p.1795]