12.07.2015 Views

Knowledge Advisor - catia

Knowledge Advisor - catia

Knowledge Advisor - catia

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Manipulating Feature AttributesNot all the features can be accessed and modified in a behavior. You can only manipulate the objects which are below theShape object in the automation object hierarchy. Here is an example which illustrates how to manipulate feature attributes.The feature to be dragged and dropped is a simple type hole. When the behavior is executed:1. the following hole properties are displayed in a Visual Basic message box:the feature type,the feature namethe hole diameter.2.the user is promptedeither to click OK to modify the hole properties after it is dropped. New property values will be:hole (type = 2diameter = 10.0head diameter = 20.0.or to click Cancel and just drop the initial hole without modifying its properties.1.2.3.Create a pad with at least a simple type hole to be dragged and dropped.Select the root feature and access the <strong>Knowledge</strong> <strong>Advisor</strong> workbench.Select any hole feature either in the geometry area or in the specification tree4.5.Click the icon. The Behavior editor is displayed.Copy/Paste the code below from your browser to the behavior editor.Dim FeatureType, FeatureName, HoleTypeFeatureType = TypeName(MyEvent.GetDroppedFeature)FeatureName = MyEvent.GetDroppedFeature.NameHoleType = MyEvent.GetDroppedFeature.TypeStr1="The feature to be dropped"Str2=Str1 & vbCrLf & "is a " & FeatureType & " type feature"Str3=Str2 & vbCrLf & "Its name is '" & FeatureName & "'"Str4=Str3 & vbCrLf & "Its initial diameter is " & MyEvent.GetDroppedFeature.Diameter.Value & vbCrLfStr5=Str4 & vbCrLf & "Unless you click Cancel, it will be converted into a counterbored hole"Dim MyBoxMyBox = MsgBox (Str5,1)if MyBox = 1 thenMyEvent.GetDroppedFeature.Type = 2MyEvent.GetDroppedFeature.HeadDiameter.Value = 20.0MyEvent.GetDroppedFeature.Diameter.Value = 10.0End If

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!