iProperties value change -how ... contents center file except

iProperties value change -how ... contents center file except

HyoSeok_Kim
Contributor Contributor
300 Views
3 Replies
Message 1 of 4

iProperties value change -how ... contents center file except

HyoSeok_Kim
Contributor
Contributor

안녕하세요.

inventor 2020~2023 버전을 사용중입니다.

 

기존에 작성된 최상위 조립품과 하위 조립품 및 부품의 속성 값 중

status 값을 custom의 remark 값으로 이동시키고, 기존의 status 값은 빈칸으로 바꾸는 ilogic을 사용중입니다.

 

다만 하기 ilogic 구문에서 최상위 조립품에 포함된 컨텐츠 센터를 제외시키고 assy,part만 바꾸는 방법이 없을까요?

 

contents center file의 경우 수정이 되지 않기 때문에 제외를 시키고자 합니다.

 

방법을 아시는분?..

 

<사용구문>

' 어셈블리 문서 활성화.

Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument

' 어셈블리 모든 문서 참조 가져오기.

ThisApplication.[_LibraryDocumentModifiable] = True

Dim oDoc As Document

Dim oDocA As Document

 

For Each oDoc In oAsmDoc.AllReferencedDocuments

' 문서가 부품일경우.

    If oDoc.DocumentType = kPartDocumentObject Then  

        Dim oPartDoc As PartDocument = oDoc  

        Dim model As String = oPartDoc.DisplayName

        'model = model & ".ipt"

               iProperties.Value(model, "Custom", "REMARK") = ""

               iProperties.Value(model, "Custom", "REMARK") = iProperties.Value(model, "Status", "Status")

               iProperties.Value(model, "Status", "Status") = ""

              

        Else If oDoc.DocumentType = kAssemblyDocumentObject Then 

               Dim oAssemblyDoc As AssemblyDocument = oDoc 

               Dim model1 As String = oAssemblyDoc.DisplayName

        'model1 = model & ".iam"

               iProperties.Value(model1, "Custom", "REMARK") = ""

               iProperties.Value(model1, "Custom", "REMARK") = iProperties.Value(model1, "Status", "Status")

               iProperties.Value(model1, "Status", "Status") = ""

        End If

       

Next

MessageBox.Show("전송이 완료되었습니다.")

0 Likes
Accepted solutions (1)
301 Views
3 Replies
Replies (3)
Message 2 of 4

A.Acheson
Mentor
Mentor

You can check if a part is a content center part from the occurrence definition and the content center property.

Dim oOcc as ComponentOccurrence = oPartDoc.ComponentDefinition.Occurrences(1)
Dim oOccDef As PartComponentDefinition = oOcc.Definition 'Skip content center part in for loop If oOccDef.IsContentMember = True Then Continue For 'MsgBox "The occurrence is a content part.

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
Message 3 of 4

HyoSeok_Kim
Contributor
Contributor
' 어셈블리 문서 활성화.
Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument
' 어셈블리 모든 문서 참조 가져오기.
ThisApplication.[_LibraryDocumentModifiable] = True
Dim oDoc As Document
Dim oDocA As Document

For Each oDoc In oAsmDoc.AllReferencedDocuments
' 문서가 부품일경우.
    If oDoc.DocumentType = kPartDocumentObject Then   
        Dim oPartDoc As PartDocument = oDoc
		Dim oOcc As ComponentOccurrence = oPartDoc.ComponentDefinition.Occurrences(1)
		Dim oOccDef As PartComponentDefinition = oOcc.Definition
		If oOccDef.IsContentMember = True Then Continue For
        Dim model As String = oPartDoc.DisplayName
        'model = model & ".ipt"
               iProperties.Value(model, "Custom", "REMARK") = ""
               iProperties.Value(model, "Custom", "REMARK") = iProperties.Value(model, "Status", "Status")
               iProperties.Value(model, "Status", "Status") = ""
               
	Else If oDoc.DocumentType = kAssemblyDocumentObject Then  
    	Dim oAssemblyDoc As AssemblyDocument = oDoc  
    	Dim model1 As String = oAssemblyDoc.DisplayName
        'model1 = model & ".iam"
               iProperties.Value(model1, "Custom", "REMARK") = ""
               iProperties.Value(model1, "Custom", "REMARK") = iProperties.Value(model1, "Status", "Status")
               iProperties.Value(model1, "Status", "Status") = ""
        End If
        
Next
MessageBox.Show("전송이 완료되었습니다.")

------------------------------------------
답변 감사합니다.
하지만 underline 부분과 같이 규칙을 수정하였으나 오류가 발생합니다.


MY SCREENCAST LINK : https://autode.sk/3gPTZHm

0 Likes
Message 4 of 4

WCrihfield
Mentor
Mentor
Accepted solution

Hi @HyoSeok_Kim.  It looks to me like you need to replace this:

Dim oOcc As ComponentOccurrence = oPartDoc.ComponentDefinition.Occurrences(1)
Dim oOccDef As PartComponentDefinition = oOcc.Definition
If oOccDef.IsContentMember = True Then Continue For

...with this:

Dim oPartDef As PartComponentDefinition = oPartDoc.ComponentDefinition
If oPartDef.IsContentMember = True Then Continue For

I think the example that @A.Acheson is showing is for if you were iterating through assembly components, instead of referenced documents.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes