Relationship between the face and the ProfilePath that creates it

Relationship between the face and the ProfilePath that creates it

anton.gorschnev
Enthusiast Enthusiast
467 Views
2 Replies
Message 1 of 3

Relationship between the face and the ProfilePath that creates it

anton.gorschnev
Enthusiast
Enthusiast

Добрый день. Подскажите, как определить, каким опрофилепатом было создано лицо. Пример. На плоской поверхности я создаю эскиз с двумя замкнутыми профилями (пусть это будут профили, образованные кругом и прямоугольником, геометрия меняется во время работы программы), делаю разрез. Чтобы присвоить атрибуты, необходимо определить поверхности, созданные первым и вторым полигонами соответственно.

 Dim oExtrudeFeature As ExtrudeFeature
Установите oExtrudeFeature = oPart.AttributeManager.FindObjects ("SaddleSupport"," Extrusion","PlateHoleFastener").Пункт(1)

Dim oProfilePath как ProfilePath
Установите oProfilePath = oExtrudeFeature.Профиль.Пункт(1)

Dim oProfileEntity как ProfileEntity
Установите oProfileEntity = oProfilePath.Пункт(1)
Dim oObject как объект
Установите oObject = oProfileEntity.Кривая

'????
Набор oFace = oExtrudeFeature.Боковые грани.Пункт(1)
0 Likes
Accepted solutions (1)
468 Views
2 Replies
Replies (2)
Message 2 of 3

anton.gorschnev
Enthusiast
Enthusiast

Победил, возможно кому нибудь будет полезно или у кого появиться более простое решение.

Public Sub atr1()

Dim oPart как PartDocument
Dim oCompDef как PartComponentDefinition
Dim oAttribSet As AttributeSet
Дим Овсянников как изобретатель.Атрибут
Тусклый офас как лицо

Установите oPart = ThisApplication.ActiveDocument

Dim oExtrudeFeature As ExtrudeFeature
Установите oExtrudeFeature = oPart.AttributeManager.FindObjects ("SaddleSupport"," Extrusion","PlateHoleFastener").Пункт(1)

Dim oO1 как объект
Dim oO2 как объект
Dim i как целое число
i = 0
Dim oProfileEntity как ProfileEntity
Для каждого опрофилепата в oExtrudeFeature.Профиль
i = i + 1
 Для каждого oProfileEntity в oProfilePath
 Установите oO1 = oProfileEntity.SketchEntity
 Для каждого из них в oExtrudeFeature.Боковые грани
 Установите oO2 = oFace.[_Createdfromcurve]
 Если oO1 - это oO2, то
 Set oAttributeSet = oFace.Атрибутивные наборы.Добавить ("SaddleSupport")
 Установите oAttr = oAttributeSet.Добавить ("PlateHoleFastener", ValueTypeEnum.kStringType," HoleFastener " & i)
 Конец, Если
 Далее
 Далее
Далее
Конец Субмарины
0 Likes
Message 3 of 3

anton.gorschnev
Enthusiast
Enthusiast
Accepted solution
Public Sub atr1()

Dim oPart As PartDocument
Dim oCompDef As PartComponentDefinition
Dim oAttribSet As AttributeSet
Dim oAttr As Inventor.Attribute
Dim oFace As Face

Set oPart = ThisApplication.ActiveDocument

Dim oExtrudeFeature As ExtrudeFeature
Set oExtrudeFeature = oPart.AttributeManager.FindObjects("SaddleSupport", "Extrusion", "PlateHoleFastener").Item(1)

Dim oO1 As Object
Dim oO2 As Object
Dim i As Integer
i = 0
Dim oProfileEntity As ProfileEntity
For Each oProfilePath In oExtrudeFeature.Profile
i = i + 1
    For Each oProfileEntity In oProfilePath
            Set oO1 = oProfileEntity.SketchEntity
            For Each oFace In oExtrudeFeature.SideFaces
                Set oO2 = oFace.[_CreatedFromCurve]
                If oO1 Is oO2 Then
                 Set oAttributeSet = oFace.AttributeSets.Add("SaddleSupport")
                 Set oAttr = oAttributeSet.Add("PlateHoleFastener", ValueTypeEnum.kStringType, "HoleFastener" & i)
                 End If
            Next
    Next
Next
End Sub
0 Likes