sketch in assmebly

sketch in assmebly

Anonymous
Not applicable
407 Views
1 Reply
Message 1 of 2

sketch in assmebly

Anonymous
Not applicable

Hi,

I have problem with creating of a Rectangle in a sketch.

I would like to make a profile in assembbly and then make a "revolve".

 

Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument

 

Dim oCompDef As AssemblyComponentDefinition
Set oCompDef = oAsmDoc.ComponentDefinition

 

Dim oSketch As PlanarSketch
Set oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes(3))

 

Dim oTransGeom As TransientGeometry
Set oTransGeom = ThisApplication.TransientGeometry

 

'IT CRASHES HERE

'Set oRectangleLines = oSketch.SketchLines.AddAsTwoPointRectangle(oTransGeom.CreatePoint2d(0, 0), oTransGeom.CreatePoint2d(100, 0))

 

Dim oProfile As Profile
Set oProfile = oSketch.Profiles.AddForSolid

 

Dim oWorkAxis As Object
Set oWorkAxis = oCompDef.WorkAxes.Item(1)

 

Dim oRevoleveDef As RevolveFeature
Set oRevoleveDef = oCompDef.Features.RevolveFeatures.AddByAngle(oProfile, oWorkAxis, 360, kPositiveExtentDirection, kCutOperation)

 

 

 

Anybody who can help me?

 

Thanks!

Jiri

0 Likes
Accepted solutions (1)
408 Views
1 Reply
Reply (1)
Message 2 of 2

philippe.leefsma
Alumni
Alumni
Accepted solution

Your rectangle has no width, altough I would expect it to work... Anyway, I changed the code as follow and it fixes the issue:

 

Dim ents As SketchEntitiesEnumerator
Set ents = oSketch.SketchLines.AddAsTwoPointRectangle(oTransGeom.CreatePoint2d(0, 0), oTransGeom.CreatePoint2d(100, 100))

Regards,

Philippe.



Philippe Leefsma
Developer Technical Services
Autodesk Developer Network

0 Likes