Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Draft Form - Square

Status
Not open for further replies.

perzo84

Mechanical
Mar 13, 2008
22
GB
Hi,

I have problem with VBScript. I need to use DRAFT in my model with option Draft Form -> Square. When I'm using GUI it is working fine but I need to implement it into VBScript but there is no such code for changing Draft Form form Cone to Square. If someone had similar problem please write me about it.

Code:
Language="VBSCRIPT"

Sub CATMain()

Dim partDocument1 As Document
Set partDocument1 = CATIA.ActiveDocument

Dim part1 As Part
Set part1 = partDocument1.Part

Dim shapeFactory1 As Factory
Set shapeFactory1 = part1.ShapeFactory

Dim reference1 As Reference
Set reference1 = part1.CreateReferenceFromName("")

Dim draft1 As Draft
Set draft1 = shapeFactory1.AddNewDraft(reference1, reference1, catNoneDraftNeutralPropagationMode, reference1, 0.000000, 0.000000, 1.000000, 0, 5.000000, 0)

Dim draftDomains1 As DraftDomains
Set draftDomains1 = draft1.DraftDomains

Dim draftDomain1 As DraftDomain
Set draftDomain1 = draftDomains1.Item(1)

draftDomain1.SetPullingDirection 0.000000, 0.000000, 1.000000

Dim bodies1 As Bodies
Set bodies1 = part1.Bodies

Dim body1 As Body
Set body1 = bodies1.Item("Body.2")

Dim shapes1 As Shapes
Set shapes1 = body1.Shapes

Dim constRadEdgeFillet1 As Shape
Set constRadEdgeFillet1 = shapes1.Item("EdgeFillet.5")

Dim reference2 As Reference
Set reference2 = part1.CreateReferenceFromBRepName("RSur:(Face:(Brp:(Pad.3;2);None:();Cf11:());WithTemporaryBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", constRadEdgeFillet1)

draftDomain1.AddFaceToDraft reference2

draftDomain1.NeutralPropagationMode = catSmoothDraftNeutralPropagationMode

Dim reference3 As Reference
Set reference3 = part1.CreateReferenceFromBRepName("RSur:(Face:(Brp:(Pad.3;0:(Brp:(Sketch.4;11)));None:();Cf11:());WithTemporaryBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", constRadEdgeFillet1)

draftDomain1.NeutralElement = reference3

draftDomain1.SetPullingDirection -0.000000, -0.000000, 1.000000

Dim pad1 As Shape
Set pad1 = shapes1.Item("Pad.3")

Dim reference4 As Reference
Set reference4 = part1.CreateReferenceFromBRepName("FSur:(Face:(Brp:(Pad.3;0:(Brp:(Sketch.4;13)));None:();Cf11:());WithTemporaryBody;WithoutBuildError;WithInitialFeatureSupport;MFBRepVersion_CXR15)", pad1)

draftDomain1.PullingDirectionElement = reference4

part1.Update 

End Sub

Chears,
Konrad
 
 http://files.engineering.com/getfile.aspx?folder=8e0d35e6-9927-4ad3-a523-4842b7e22185&file=error_noDRAFT.docx
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top