다음 여러 레슨에서는 조립품의 컨텐츠를 관리하는 일련의 규칙을 작성합니다.
이 모형에는 iLogic 규칙이 포함된 manifold_block:1이라는 부품이 들어 있습니다. 조립품 단계 매개변수를 부품으로 전달해야 합니다.
이 규칙은 조립품에서 제어 매개변수의 해당 값에 따라 부품에서 매개변수를 설정합니다. 매개변수 기능은 구성요소 이름과 매개변수 이름을 지정합니다.
Parameter("manifold_block:1", "block") = block Parameter("manifold_block:1", "component_type") = component_type Parameter("manifold_block:1", "port_a_size") = port_a_size Parameter("manifold_block:1", "port_b_size") = port_b_size Parameter("manifold_block:1", "port_c_size") = port_c_size
복합 블록 부품 튜토리얼에서는 T자형 및 엘보우 스타일을 제어하는 복합 블록 부품에 규칙을 추가했습니다. 또한 조립품 단계에서도 규칙을 추가해야 합니다. 기존 규칙을 다시 작성하지 않고 원래 규칙을 복사합니다.
If component_type = "standard" Then port_b_size = port_a_size port_c_size = port_a_size End If
Port A의 포트 크기를 변경하는 경우 다음 여러 작업을 수행해야 합니다.
다음을 수행하여 규칙을 추가합니다.
이 규칙의 첫 번째 부분은 결합 부품의 iPart 테이블에 저장된 정보를 기준으로 나사 패턴 간격을 조정합니다.
i = iPart.FindRow("port_a_union", "port_size", "=", port_a_size) port_a_y_dist_between_screws = iPart.CurrentRowValue("y_dist_betwn_screw") port_a_x_dist_between_screws = iPart.CurrentRowValue("x_dist_betwn_screw")
규칙의 다음 부품은 선택한 포트 크기를 기준으로 나사 부품 내부에서 적절한 iPart 행을 선택합니다.
If port_a_size = .50 Then iPart.ChangeRow("port_a_union_screw", "Screw-01") ElseIf port_a_size = 0.75 Then iPart.ChangeRow("port_a_union_screw", "Screw-02") ElseIf port_a_size = 1.00 Then iPart.ChangeRow("port_a_union_screw", "Screw-02") ElseIf port_a_size = 1.25 Then iPart.ChangeRow("port_a_union_screw", "Screw-03") ElseIf port_a_size = 1.50 Then iPart.ChangeRow("port_a_union_screw", "Screw-04") ElseIf port_a_size = 2.00 Then iPart.ChangeRow("port_a_union_screw", "Screw-04") ElseIf port_a_size = 2.50 Then iPart.ChangeRow("port_a_union_screw", "Screw-05") ElseIf port_a_size = 3.00 Then iPart.ChangeRow("port_a_union_screw", "Screw-06") End If
port_a_union_part_number = iProperties.Value("port_a_union", "Project", "Part Number")
Port B는 엘보우 복합 블록에 없으므로 Port A 및 Port C와 다릅니다. 복합 블록이 엘보우 스타일 블록이면 이 포트에 사용된 결합 캡과 결합 나사를 억제해야 합니다. 또한 결합 캡과 연관된 메이트 구속조건도 억제해야 합니다.
구속조건을 억제 중이므로 규칙을 작성하기 전에 세부 수준을 설정합니다. 조립품에서 세부 수준과 관련된 항목에 영향을 미치는 규칙의 경우 규칙을 작성하기 전에 사용자 세부 수준이 정의되고 저장되어 있어야 합니다. 사용자 세부 수준이 정의되어 있지 않으면 iLogic에서 오류 메시지를 생성합니다.
세부 수준 설정
새 세부 수준이 추가됩니다.
규칙 작성
이제 규칙을 작성할 수 있습니다.
If block = "elbow" Then isTee = False ElseisTee = True End If
이후에 이 변수를 사용하여 다른 매개변수를 설정합니다.
Constraint.IsActive("port_b_cap_center") = isTee Constraint.IsActive("port_b_cap_hole") = isTee Constraint.IsActive("port_b_cap_face") = isTee Constraint.IsActive("port_b_cap_screw") = isTee
이제 isTee 변수를 사용하여 block 매개변수 값에 따라 이러한 구속조건을 켜거나 끌 수 있습니다.
Component.IsActive("port_b_union") = isTee Component.IsActive("port_b_screw_pattern") = isTee
이러한 행에서는 isTee 변수를 사용합니다. 나사 패턴이 억제되어 있으면 나사 구성요소도 억제됩니다.
if isTee Then i = iPart.FindRow("port_b_union", "port_size", "=", port_b_size) port_b_y_dist_between_screws = iPart.CurrentRowValue("y_dist_betwn_screw") port_b_x_dist_between_screws = iPart.CurrentRowValue("x_dist_betwn_screw") port_b_union_part_number = iProperties.Value("port_b_union", "Project", "Part Number") End If
If isTee 문이 이러한 전체 블록을 포함하므로 해당 행은 T자형 스타일 복합 블록에 대해서만 처리됩니다. If isTee Then 문은 If isTee = True Then 문과 동일하지만 보다 간결한 표현식 형식을 제공합니다.
먼저 port_b_size 매개변수의 값에 따라 결합 부품의 iPart 테이블에서 적절한 행을 선택한 다음 x 및 y 패턴 간격띄우기에 사용할 값을 추출합니다. 그런 다음 결합 부품에서 부품 번호를 추출하고 이후에 참조할 수 있도록 다른 매개변수에 해당 값을 저장합니다.
If port_b_size = .50 then iPart.ChangeRow("port_b_union_screw", "Screw-01") elseif port_b_size = .75 then iPart.ChangeRow("port_b_union_screw", "Screw-02") elseif port_b_size = 1.00 then iPart.ChangeRow("port_b_union_screw", "Screw-02") elseif port_b_size = 1.25 then iPart.ChangeRow("port_b_union_screw", "Screw-03") elseif port_b_size = 1.50 then iPart.ChangeRow("port_b_union_screw", "Screw-04") elseif port_b_size = 2.00 then iPart.ChangeRow("port_b_union_screw", "Screw-04") elseif port_b_size = 2.50 then iPart.ChangeRow("port_b_union_screw", "Screw-05") elseif port_b_size = 3.00 then iPart.ChangeRow("port_b_union_screw", "Screw-06") End If
Port A를 참조하는 모든 항목이 대신 Port C를 참조한다는 점을 제외하면 Port C에 대한 규칙은 Port A에 대한 규칙과 거의 동일합니다.
i = iPart.FindRow("port_c_union", "port_size", "=", port_c_size) port_c_y_dist_between_screws = iPart.CurrentRowValue("y_dist_betwn_screw") port_c_x_dist_between_screws = iPart.CurrentRowValue("x_dist_betwn_screw") If port_c_size = .50 then iPart.ChangeRow("port_c_union_screw", "Screw-01") elseif port_c_size = .75 then iPart.ChangeRow("port_c_union_screw", "Screw-02") elseif port_c_size = 1.00 then iPart.ChangeRow("port_c_union_screw", "Screw-02") elseif port_c_size = 1.25 then iPart.ChangeRow("port_c_union_screw", "Screw-03") elseif port_c_size = 1.50 then iPart.ChangeRow("port_c_union_screw", "Screw-04") elseif port_c_size = 2.00 then iPart.ChangeRow("port_c_union_screw" "Screw-04") elseif port_c_size = 2.50 then iPart.ChangeRow("port_c_union_screw", "Screw-05") elseif port_c_size = 3.00 then iPart.ChangeRow("port_c_union_screw", "Screw-06") End If port_c_union_part_number = iProperties.Value("port_c_union", "Project", "Part Number")