Accesing SketchLines in SketchEntitiesenumerator

Accesing SketchLines in SketchEntitiesenumerator

ravikmb5
Collaborator Collaborator
545 Views
5 Replies
Message 1 of 6

Accesing SketchLines in SketchEntitiesenumerator

ravikmb5
Collaborator
Collaborator

How do we access Sketchline.Startskechpoint in Sketch Entities Enumerator

 

For example

Dim offsetEnt As SketchEntitiesEnumerator = oSketch(3).OffsetSketchEntitiesUsingDistance(objcol,2.5, False,False, True)

 

I need to access Sketch Lines in SketchEntitiesEnumerator

 

Please mark this response as Problem Solved if it answers your question.
----------------------------------------------------------------------------------------------
Ravi Kumar MB,
HP Z220 SFF Workstation
Autodesk Inventor Certified professional 2016
Email: ravikmb5@gmail.com





0 Likes
Accepted solutions (1)
546 Views
5 Replies
Replies (5)
Message 2 of 6

Michael.Navara
Advisor
Advisor

SketchEntitiesEnumerator is a collection of sketch entities. You need to iterate all items in collection and check if it is a SketchLine. Then you can re-type them to Sketchline and access Startskechpoint as usual.

  

0 Likes
Message 3 of 6

ravikmb5
Collaborator
Collaborator

i am getting these errors

not able to iterate Sketch Lines in SketchEntitiesEnumerator

Please mark this response as Problem Solved if it answers your question.
----------------------------------------------------------------------------------------------
Ravi Kumar MB,
HP Z220 SFF Workstation
Autodesk Inventor Certified professional 2016
Email: ravikmb5@gmail.com





0 Likes
Message 4 of 6

Michael.Navara
Advisor
Advisor

Can you share minimalistic part of your code?

0 Likes
Message 5 of 6

ravikmb5
Collaborator
Collaborator
Sub Main()
	Dim StartTime As DateTime
	Dim ElapsedTime As TimeSpan
	StartTime = Now

	' Defining This Document
	Dim oPartDoc As PartDocument = ThisApplication.ActiveDocument
	'Definining a Component Definition
	Dim oPartDef As PartComponentDefinition = oPartDoc.ComponentDefinition

	Dim oParams As Parameters
	oParams = oPartDef.Parameters
	Dim oUserParams As UserParameters
	oUserParams = oParams.UserParameters
	Dim assetLib As AssetLibrary = ThisApplication.AssetLibraries.Item("Autodesk Appearance Library")

	Dim oCircle(10) As SketchCircle
	Dim oLine(20) As SketchLine
	Dim oPrLine(20) As SketchLine
	Dim oPoint(10) As SketchPoint
	Dim oProjectionPoint(10) As SketchPoint
	Dim oCon(10) As CoincidentConstraint
	Dim oDim(10) As TwoPointDistanceDimConstraint
	Dim oOffsetDim(6) As OffsetDimConstraint
	Dim oAngDim(6) As TwoLineAngleDimConstraint
	Dim oProfile(6) As Profile
	Dim oExtrudeDef(0 To 6) As ExtrudeDefinition
	Dim oExtrusion(6) As ExtrudeFeature
	Dim oFillet(10) As FilletFeature
	Dim oSkArc(10) As SketchArc
	Dim oPrArc(10) As SketchArc

	Dim oArcDim(10) As ArcLengthDimConstraint
	Dim oAngleDim(10) As ThreePointAngleDimConstraint
	Dim oRDim(0 To 6) As RadiusDimConstraint
	Dim oTanDim(10) As TangentDistanceDimConstraint
	Dim oRs(3) As RenderStyle
	Dim oProximityPoint(10) As Point2d
	Dim oProximityPoints(10) As Point
	Dim ExtrudeFeatDistExtent(10) As DistanceExtent

	'[ Create's a Profile Sketch
	Dim oSketch(10) As PlanarSketch
	oSketch(1) = oPartDef.Sketches.Add(oPartDef.WorkPlanes.Item(2))
	oSketch(1).Name = "Base Profile Sketch"
	'Collecting Transient Geometry
	Dim tg As TransientGeometry
	tg = ThisApplication.TransientGeometry
	oRs(1) = oPartDoc.RenderStyles.Item("Default")
	oRs(2) = oPartDoc.RenderStyles.Item("Shellac")
	oRs(3) = oPartDoc.RenderStyles.Item("Red")
	oPartDoc.ActiveRenderStyle = oRs(2)


	oProjectionPoint(1) = oSketch(1).AddByProjectingEntity(oPartDef.WorkPoints.Item(1))

	oLine(1) = oSketch(1).SketchLines.AddByTwoPoints(tg.CreatePoint2d(0, 6.25), tg.CreatePoint2d(0, - 6.25))
	Call oSketch(1).GeometricConstraints.AddVertical(oLine(1))

	oLine(2) = oSketch(1).SketchLines.AddByTwoPoints(oLine(1).EndSketchPoint, tg.CreatePoint2d(8.9325, -3.8565))
	oLine(3) = oSketch(1).SketchLines.AddByTwoPoints(oLine(1).StartSketchPoint, tg.CreatePoint2d(8.9325, 3.8565))


	oPrLine(1) = oSketch(1).AddByProjectingEntity(oPartDef.WorkAxes.Item(1))
	oPrLine(1).Construction = True
	Call oSketch(1).GeometricConstraints.AddCoincident(oLine(1), oProjectionPoint(1))
	
	oSkArc(1) = oSketch(1).SketchArcs.AddByCenterStartEndPoint(tg.CreatePoint2d(2.5, 0), oLine(2).EndSketchPoint,oLine(3).EndSketchPoint,True)
	Call oSketch(1).GeometricConstraints.AddVerticalAlign(oSkArc(1).StartSketchPoint, oSkArc(1).EndSketchPoint)
	Call oSketch(1).GeometricConstraints.AddCoincident(oSkArc(1).CenterSketchPoint,oPrLine(1))
	Call oSketch(1).GeometricConstraints.AddSymmetry(oLine(2),oLine(3),oPrLine(1))

	oDim(1) = oSketch(1).DimensionConstraints.AddTwoPointDistance(oLine(1).StartSketchPoint,oLine(1).EndSketchPoint,DimensionOrientationEnum.kVerticalDim,tg.CreatePoint2d(-2.5,0))
	oDim(1).Parameter.Expression = "d0=125"
	
	oRDim(1) = oSketch(1).DimensionConstraints.AddRadius(oSkArc(1), tg.CreatePoint2d(7.5,- 1.7))
	oRDim(1).Parameter.Expression = "d1=75mm"
	
	oProximityPoint(1) = tg.CreatePoint2d(10.0, 0)
	oProximityPoint(2) = tg.CreatePoint2d(0, 0)
	oTanDim(1) = oSketch(1).DimensionConstraints.AddTangentDistance(oSkArc(1), oLine(1),oProximityPoint(1), oProximityPoint(2), tg.CreatePoint2d(5.00, -8.0), False)
	oTanDim(1).Parameter.Expression= "d2=100"
	
	oPoint(1) =oSketch(1).SketchPoints.Add(tg.CreatePoint2d(8.9325, -6.25))
	Call oSketch(1).GeometricConstraints.AddHorizontalAlign(oLine(1).EndSketchPoint, oPoint(1))
	Call oSketch(1).GeometricConstraints.AddVerticalAlign(oLine(2).EndSketchPoint, oPoint(1))
	
	oAngleDim(1) = oSketch(1).DimensionConstraints.AddThreePointAngle(oPoint(1),oLine(1).EndSketchPoint,oLine(2).EndSketchPoint,tg.CreatePoint2d(10.8,-4.7))
	oAngleDim(1).Parameter.Expression = "d3=15"

	Call oSketch(1).Solve
	']
	'[ Create's a Revolve Sketch
	
	oSketch(2) = oPartDef.Sketches.Add(oPartDef.WorkPlanes.Item(1))
	oSketch(2).Name = "Revolve Surface Sketch"

	oProjectionPoint(2) = oSketch(2).AddByProjectingEntity(oPartDef.WorkPoints.Item(1))

	oLine(4) = oSketch(2).SketchLines.AddByTwoPoints(tg.CreatePoint2d(-12.0, -6.25), tg.CreatePoint2d(-12.0, 6.25))
	Call oSketch(2).GeometricConstraints.AddVertical(oLine(4))
	oLine(4).Construction = True
	oLine(4).Centerline = True
	
	oPoint(2) = oSketch(2).AddByProjectingEntity(oLine(1).StartSketchPoint)
	oPoint(3) =oSketch(2).AddByProjectingEntity(oLine(1).EndSketchPoint)
	Call oSketch(2).GeometricConstraints.AddHorizontalAlign(oLine(4).StartSketchPoint,oPoint(2))
	Call oSketch(2).GeometricConstraints.AddHorizontalAlign(oLine(4).EndSketchPoint,oPoint(3))
	
	oPrLine(2) = oSketch(2).AddByProjectingEntity(oPartDef.WorkAxes.Item(3))
	oPrLine(2).Construction = True
	
	oPrLine(3) = oSketch(2).AddByProjectingEntity(oPartDef.WorkAxes.Item(2))
	oPrLine(3).Construction = True
	
	oDim(2) = oSketch(1).DimensionConstraints.AddTwoPointDistance(oLine(4).StartSketchPoint,oPoint(2),DimensionOrientationEnum.kHorizontalDim,tg.CreatePoint2d(-7.4,11.5))
	oDim(2).Parameter.Expression = "d4=120"
	
	oSkArc(2) = oSketch(2).SketchArcs.AddByCenterStartEndPoint(tg.CreatePoint2d(-12, 0), tg.CreatePoint2d(2.72888, -6.25), tg.CreatePoint2d(2.7288, 6.25), True)
	Call oSketch(2).GeometricConstraints.AddCoincident(oLine(4),oSkArc(2).CenterSketchPoint)
	Call oSketch(2).GeometricConstraints.AddCoincident(oPrLine(3),oSkArc(2).CenterSketchPoint)
	Call oSketch(2).GeometricConstraints.AddVerticalAlign(oSkArc(2).StartSketchPoint, oSkArc(2).EndSketchPoint)
	Call oSketch(2).GeometricConstraints.AddHorizontalAlign(oSkArc(2).StartSketchPoint, oPoint(3))
	
	oRDim(2) = oSketch(2).DimensionConstraints.AddRadius(oSkArc(2), tg.CreatePoint2d(-3.17, 1.7155))
	oRDim(2).Parameter.Expression = "d5=160mm"
	
	oSkArc(3) = oSketch(2).SketchArcs.AddByCenterStartEndPoint(tg.CreatePoint2d(-12, 0), tg.CreatePoint2d(3.8094, -6.25), tg.CreatePoint2d(3.8094, 6.25), True)
	Call oSketch(2).GeometricConstraints.AddCoincident(oLine(4),oSkArc(3).CenterSketchPoint)
	Call oSketch(2).GeometricConstraints.AddCoincident(oPrLine(3),oSkArc(3).CenterSketchPoint)
	Call oSketch(2).GeometricConstraints.AddVerticalAlign(oSkArc(3).StartSketchPoint, oSkArc(3).EndSketchPoint)
	Call oSketch(2).GeometricConstraints.AddHorizontalAlign(oSkArc(3).StartSketchPoint, oPoint(3))
	
	oRDim(3) = oSketch(2).DimensionConstraints.AddRadius(oSkArc(3), tg.CreatePoint2d(-3.210, 5.323))
	oRDim(3).Parameter.Expression = "d6=170mm"
		Call oSketch(2).Solve
	''Surface Revolve
	oProfile(1) = oSketch(2).Profiles.AddForSurface(oSkArc(2))	
	Dim oRevolve(2) As RevolveFeature
	oRevolve(1) = oPartDef.Features.RevolveFeatures.AddByAngle(oProfile(1),oLine(4),"d8 = 90deg",PartFeatureExtentDirectionEnum.kNegativeExtentDirection,PartFeatureOperationEnum.kSurfaceOperation)
	oRevolve(1).Name = "Surface_Revolve_160"
''end First Surface

	''Surface Revolve
	oProfile(2) = oSketch(2).Profiles.AddForSurface(oSkArc(3))	
	
	oRevolve(2) = oPartDef.Features.RevolveFeatures.AddByAngle(oProfile(2),oLine(4),"d9 = 90deg",PartFeatureExtentDirectionEnum.kNegativeExtentDirection,PartFeatureOperationEnum.kSurfaceOperation)
	oRevolve(2).Name = "Surface_Revolve_170"
''end Second Surface

	']
	
	'[Extrusion upto Surface160
	
	Dim oSurf(2) As WorkSurface
	Dim oSurfBody(2) As SurfaceBody
	
	oSurf(1) = oRevolve(1).SurfaceBodies.Item(1).Parent
	oSurf(1).Translucent = True
	oSurf(1).Visible = False
	oSurfBody(1) = oSurf(1).SurfaceBodies.Item(1)
	
	oSurf(2) = oRevolve(2).SurfaceBodies.Item(1).Parent
	oSurf(2).Translucent = True
	oSurf(2).Visible = False
	oSurfBody(2) = oSurf(2).SurfaceBodies.Item(1)
	

	oProfile(3) = oSketch(1).Profiles.AddForSolid()
'	Dim oExtrusion(10)  As ExtrudeFeature
	oExtrusion(1) = oPartDef.Features.ExtrudeFeatures.AddByToNextExtent(oProfile(3), PartFeatureExtentDirectionEnum.kPositiveExtentDirection,oSurfBody(1), PartFeatureOperationEnum.kNewBodyOperation)
	oExtrusion(1).Name = "Extrusion upto Surface160"
	oExtrusion(1).TaperAngle.Name = "d10"
']

'[....Offset Sketch

	oSketch(3) = oPartDef.Sketches.Add(oPartDef.WorkPlanes.Item(2))
	oSketch(3).Name = "Offset Sketch"
	
	oPrLine(4) = oSketch(3).AddByProjectingEntity(oLine(1))
	oPrLine(5) = oSketch(3).AddByProjectingEntity(oLine(2))
	oPrLine(6) = oSketch(3).AddByProjectingEntity(oLine(3))
	oPrjArc = oSketch(3).AddByProjectingEntity(oSkArc(1))
	
	Dim oSkEntColl As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection()
  			oSkEntColl.Add(oPrLine(4))
			oSkEntColl.Add(oPrLine(5))
			oSkEntColl.Add(oPrjArc)
			oSkEntColl.Add(oPrLine(6))
			
	Dim oOffsetEnt As SketchEntitiesEnumerator
	oOffsetEnt = oSketch(3).OffsetSketchEntitiesUsingDistance(oSkEntColl,2.5,False,False,True)
	oOffsetEnt.Item(1).Construction = True
	
'	Dim oLinex(0 To 3) As SketchLine
'	For i = 0 To 3
'		oSketchLines = oOffsetEnt.Item
'		aoDrawCurves(i) = oDrawViewCurves.Item(1)
'	Next
	
'	For Each oLinex As SketchLine In oOffsetEnt
''		
'If oLinex(1) Is oOffsetEnt.Item(1) Then

'End If

'Next
'		Next
	
'			Call oOffsetEnt(1) = oLine(7)

']
	Dim oCamera As Camera
	oCamera = ThisApplication.ActiveView.Camera
	oCamera.ViewOrientationType = ViewOrientationTypeEnum.kLeftViewOrientation
	oCamera.Apply()
	iLogicVb.UpdateWhenDone = True'					Dim oCamera7 As Camera

	oPartDoc.ActiveRenderStyle = oRs(2)

	ElapsedTime = Now().Subtract(StartTime)
	MessageBox.Show("Time Taken To Create Model Mania 2004: " & ElapsedTime.TotalSeconds & " Seconds", "CAD PROFESSOR")
	ThisDoc.Save
Sub Main() Dim StartTime As DateTime Dim ElapsedTime As TimeSpan StartTime = Now ' Defining This Document Dim oPartDoc As PartDocument = ThisApplication.ActiveDocument 'Definining a Component Definition Dim oPartDef As PartComponentDefinition = oPartDoc.ComponentDefinition Dim oParams As Parameters oParams = oPartDef.Parameters Dim oUserParams As UserParameters oUserParams = oParams.UserParameters Dim assetLib As AssetLibrary = ThisApplication.AssetLibraries.Item("Autodesk Appearance Library") Dim oCircle(10) As SketchCircle Dim oLine(20) As SketchLine Dim oPrLine(20) As SketchLine Dim oPoint(10) As SketchPoint Dim oProjectionPoint(10) As SketchPoint Dim oCon(10) As CoincidentConstraint Dim oDim(10) As TwoPointDistanceDimConstraint Dim oOffsetDim(6) As OffsetDimConstraint Dim oAngDim(6) As TwoLineAngleDimConstraint Dim oProfile(6) As Profile Dim oExtrudeDef(0 To 6) As ExtrudeDefinition Dim oExtrusion(6) As ExtrudeFeature Dim oFillet(10) As FilletFeature Dim oSkArc(10) As SketchArc Dim oPrArc(10) As SketchArc Dim oArcDim(10) As ArcLengthDimConstraint Dim oAngleDim(10) As ThreePointAngleDimConstraint Dim oRDim(0 To 6) As RadiusDimConstraint Dim oTanDim(10) As TangentDistanceDimConstraint Dim oRs(3) As RenderStyle Dim oProximityPoint(10) As Point2d Dim oProximityPoints(10) As Point Dim ExtrudeFeatDistExtent(10) As DistanceExtent '[ Create's a Profile Sketch Dim oSketch(10) As PlanarSketch oSketch(1) = oPartDef.Sketches.Add(oPartDef.WorkPlanes.Item(2)) oSketch(1).Name = "Base Profile Sketch" 'Collecting Transient Geometry Dim tg As TransientGeometry tg = ThisApplication.TransientGeometry oRs(1) = oPartDoc.RenderStyles.Item("Default") oRs(2) = oPartDoc.RenderStyles.Item("Shellac") oRs(3) = oPartDoc.RenderStyles.Item("Red") oPartDoc.ActiveRenderStyle = oRs(2) oProjectionPoint(1) = oSketch(1).AddByProjectingEntity(oPartDef.WorkPoints.Item(1)) oLine(1) = oSketch(1).SketchLines.AddByTwoPoints(tg.CreatePoint2d(0, 6.25), tg.CreatePoint2d(0, - 6.25)) Call oSketch(1).GeometricConstraints.AddVertical(oLine(1)) oLine(2) = oSketch(1).SketchLines.AddByTwoPoints(oLine(1).EndSketchPoint, tg.CreatePoint2d(8.9325, -3.8565)) oLine(3) = oSketch(1).SketchLines.AddByTwoPoints(oLine(1).StartSketchPoint, tg.CreatePoint2d(8.9325, 3.8565)) oPrLine(1) = oSketch(1).AddByProjectingEntity(oPartDef.WorkAxes.Item(1)) oPrLine(1).Construction = True Call oSketch(1).GeometricConstraints.AddCoincident(oLine(1), oProjectionPoint(1)) oSkArc(1) = oSketch(1).SketchArcs.AddByCenterStartEndPoint(tg.CreatePoint2d(2.5, 0), oLine(2).EndSketchPoint,oLine(3).EndSketchPoint,True) Call oSketch(1).GeometricConstraints.AddVerticalAlign(oSkArc(1).StartSketchPoint, oSkArc(1).EndSketchPoint) Call oSketch(1).GeometricConstraints.AddCoincident(oSkArc(1).CenterSketchPoint,oPrLine(1)) Call oSketch(1).GeometricConstraints.AddSymmetry(oLine(2),oLine(3),oPrLine(1)) oDim(1) = oSketch(1).DimensionConstraints.AddTwoPointDistance(oLine(1).StartSketchPoint,oLine(1).EndSketchPoint,DimensionOrientationEnum.kVerticalDim,tg.CreatePoint2d(-2.5,0)) oDim(1).Parameter.Expression = "d0=125" oRDim(1) = oSketch(1).DimensionConstraints.AddRadius(oSkArc(1), tg.CreatePoint2d(7.5,- 1.7)) oRDim(1).Parameter.Expression = "d1=75mm" oProximityPoint(1) = tg.CreatePoint2d(10.0, 0) oProximityPoint(2) = tg.CreatePoint2d(0, 0) oTanDim(1) = oSketch(1).DimensionConstraints.AddTangentDistance(oSkArc(1), oLine(1),oProximityPoint(1), oProximityPoint(2), tg.CreatePoint2d(5.00, -8.0), False) oTanDim(1).Parameter.Expression= "d2=100" oPoint(1) =oSketch(1).SketchPoints.Add(tg.CreatePoint2d(8.9325, -6.25)) Call oSketch(1).GeometricConstraints.AddHorizontalAlign(oLine(1).EndSketchPoint, oPoint(1)) Call oSketch(1).GeometricConstraints.AddVerticalAlign(oLine(2).EndSketchPoint, oPoint(1)) oAngleDim(1) = oSketch(1).DimensionConstraints.AddThreePointAngle(oPoint(1),oLine(1).EndSketchPoint,oLine(2).EndSketchPoint,tg.CreatePoint2d(10.8,-4.7)) oAngleDim(1).Parameter.Expression = "d3=15" Call oSketch(1).Solve '] '[ Create's a Revolve Sketch oSketch(2) = oPartDef.Sketches.Add(oPartDef.WorkPlanes.Item(1)) oSketch(2).Name = "Revolve Surface Sketch" oProjectionPoint(2) = oSketch(2).AddByProjectingEntity(oPartDef.WorkPoints.Item(1)) oLine(4) = oSketch(2).SketchLines.AddByTwoPoints(tg.CreatePoint2d(-12.0, -6.25), tg.CreatePoint2d(-12.0, 6.25)) Call oSketch(2).GeometricConstraints.AddVertical(oLine(4)) oLine(4).Construction = True oLine(4).Centerline = True oPoint(2) = oSketch(2).AddByProjectingEntity(oLine(1).StartSketchPoint) oPoint(3) =oSketch(2).AddByProjectingEntity(oLine(1).EndSketchPoint) Call oSketch(2).GeometricConstraints.AddHorizontalAlign(oLine(4).StartSketchPoint,oPoint(2)) Call oSketch(2).GeometricConstraints.AddHorizontalAlign(oLine(4).EndSketchPoint,oPoint(3)) oPrLine(2) = oSketch(2).AddByProjectingEntity(oPartDef.WorkAxes.Item(3)) oPrLine(2).Construction = True oPrLine(3) = oSketch(2).AddByProjectingEntity(oPartDef.WorkAxes.Item(2)) oPrLine(3).Construction = True oDim(2) = oSketch(1).DimensionConstraints.AddTwoPointDistance(oLine(4).StartSketchPoint,oPoint(2),DimensionOrientationEnum.kHorizontalDim,tg.CreatePoint2d(-7.4,11.5)) oDim(2).Parameter.Expression = "d4=120" oSkArc(2) = oSketch(2).SketchArcs.AddByCenterStartEndPoint(tg.CreatePoint2d(-12, 0), tg.CreatePoint2d(2.72888, -6.25), tg.CreatePoint2d(2.7288, 6.25), True) Call oSketch(2).GeometricConstraints.AddCoincident(oLine(4),oSkArc(2).CenterSketchPoint) Call oSketch(2).GeometricConstraints.AddCoincident(oPrLine(3),oSkArc(2).CenterSketchPoint) Call oSketch(2).GeometricConstraints.AddVerticalAlign(oSkArc(2).StartSketchPoint, oSkArc(2).EndSketchPoint) Call oSketch(2).GeometricConstraints.AddHorizontalAlign(oSkArc(2).StartSketchPoint, oPoint(3)) oRDim(2) = oSketch(2).DimensionConstraints.AddRadius(oSkArc(2), tg.CreatePoint2d(-3.17, 1.7155)) oRDim(2).Parameter.Expression = "d5=160mm" oSkArc(3) = oSketch(2).SketchArcs.AddByCenterStartEndPoint(tg.CreatePoint2d(-12, 0), tg.CreatePoint2d(3.8094, -6.25), tg.CreatePoint2d(3.8094, 6.25), True) Call oSketch(2).GeometricConstraints.AddCoincident(oLine(4),oSkArc(3).CenterSketchPoint) Call oSketch(2).GeometricConstraints.AddCoincident(oPrLine(3),oSkArc(3).CenterSketchPoint) Call oSketch(2).GeometricConstraints.AddVerticalAlign(oSkArc(3).StartSketchPoint, oSkArc(3).EndSketchPoint) Call oSketch(2).GeometricConstraints.AddHorizontalAlign(oSkArc(3).StartSketchPoint, oPoint(3)) oRDim(3) = oSketch(2).DimensionConstraints.AddRadius(oSkArc(3), tg.CreatePoint2d(-3.210, 5.323)) oRDim(3).Parameter.Expression = "d6=170mm" Call oSketch(2).Solve ''Surface Revolve oProfile(1) = oSketch(2).Profiles.AddForSurface(oSkArc(2)) Dim oRevolve(2) As RevolveFeature oRevolve(1) = oPartDef.Features.RevolveFeatures.AddByAngle(oProfile(1),oLine(4),"d8 = 90deg",PartFeatureExtentDirectionEnum.kNegativeExtentDirection,PartFeatureOperationEnum.kSurfaceOperation) oRevolve(1).Name = "Surface_Revolve_160" ''end First Surface ''Surface Revolve oProfile(2) = oSketch(2).Profiles.AddForSurface(oSkArc(3)) oRevolve(2) = oPartDef.Features.RevolveFeatures.AddByAngle(oProfile(2),oLine(4),"d9 = 90deg",PartFeatureExtentDirectionEnum.kNegativeExtentDirection,PartFeatureOperationEnum.kSurfaceOperation) oRevolve(2).Name = "Surface_Revolve_170" ''end Second Surface '] '[Extrusion upto Surface160 Dim oSurf(2) As WorkSurface Dim oSurfBody(2) As SurfaceBody oSurf(1) = oRevolve(1).SurfaceBodies.Item(1).Parent oSurf(1).Translucent = True oSurf(1).Visible = False oSurfBody(1) = oSurf(1).SurfaceBodies.Item(1) oSurf(2) = oRevolve(2).SurfaceBodies.Item(1).Parent oSurf(2).Translucent = True oSurf(2).Visible = False oSurfBody(2) = oSurf(2).SurfaceBodies.Item(1) oProfile(3) = oSketch(1).Profiles.AddForSolid() ' Dim oExtrusion(10) As ExtrudeFeature oExtrusion(1) = oPartDef.Features.ExtrudeFeatures.AddByToNextExtent(oProfile(3), PartFeatureExtentDirectionEnum.kPositiveExtentDirection,oSurfBody(1), PartFeatureOperationEnum.kNewBodyOperation) oExtrusion(1).Name = "Extrusion upto Surface160" oExtrusion(1).TaperAngle.Name = "d10" '] '[....Offset Sketch oSketch(3) = oPartDef.Sketches.Add(oPartDef.WorkPlanes.Item(2)) oSketch(3).Name = "Offset Sketch" oPrLine(4) = oSketch(3).AddByProjectingEntity(oLine(1)) oPrLine(5) = oSketch(3).AddByProjectingEntity(oLine(2)) oPrLine(6) = oSketch(3).AddByProjectingEntity(oLine(3)) oPrjArc = oSketch(3).AddByProjectingEntity(oSkArc(1)) Dim oSkEntColl As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection() oSkEntColl.Add(oPrLine(4)) oSkEntColl.Add(oPrLine(5)) oSkEntColl.Add(oPrjArc) oSkEntColl.Add(oPrLine(6)) Dim oOffsetEnt As SketchEntitiesEnumerator oOffsetEnt = oSketch(3).OffsetSketchEntitiesUsingDistance(oSkEntColl,2.5,False,False,True) oOffsetEnt.Item(1).Construction = True ' Dim oLinex(0 To 3) As SketchLine ' For i = 0 To 3 ' oSketchLines = oOffsetEnt.Item ' aoDrawCurves(i) = oDrawViewCurves.Item(1) ' Next ' For Each oLinex As SketchLine In oOffsetEnt ''  'If oLinex(1) Is oOffsetEnt.Item(1) Then 'End If 'Next ' Next ' Call oOffsetEnt(1) = oLine(7) '] Dim oCamera As Camera oCamera = ThisApplication.ActiveView.Camera oCamera.ViewOrientationType = ViewOrientationTypeEnum.kLeftViewOrientation oCamera.Apply() iLogicVb.UpdateWhenDone = True' Dim oCamera7 As Camera oPartDoc.ActiveRenderStyle = oRs(2) ElapsedTime = Now().Subtract(StartTime) MessageBox.Show("Time Taken To Create Model Mania 2004: " & ElapsedTime.TotalSeconds & " Seconds", "CAD PROFESSOR") ThisDoc.Save
Please mark this response as Problem Solved if it answers your question.
----------------------------------------------------------------------------------------------
Ravi Kumar MB,
HP Z220 SFF Workstation
Autodesk Inventor Certified professional 2016
Email: ravikmb5@gmail.com





0 Likes
Message 6 of 6

ravikmb5
Collaborator
Collaborator
Accepted solution
For Each oLinex As SketchLine In oOffsetEnt
''		
'If oLinex(1) Is oOffsetEnt.Item(1) Then

'End If

Never Mind

i figured it out 

For Each oLinex As Inventor.SketchLine made the trick

 

Thank You

Please mark this response as Problem Solved if it answers your question.
----------------------------------------------------------------------------------------------
Ravi Kumar MB,
HP Z220 SFF Workstation
Autodesk Inventor Certified professional 2016
Email: ravikmb5@gmail.com





0 Likes