Angled Hole Automation using points from excel file

Angled Hole Automation using points from excel file

boznalbant
Explorer Explorer
662 Views
3 Replies
Message 1 of 4

Angled Hole Automation using points from excel file

boznalbant
Explorer
Explorer

Hi, I have a cylindrical shape on which I want to create holes. However, each hole has a different angle with respect to surface. I have 2 excel files in which there are hole coordinates for both surfaces. I want to create a hole from one surface to another with each corresponding coordinates from excel file.

 

Currently, I make a sketch and load the coordinates from excel file, then create a point for all coordinates in one surface. Then, create hole axes from point on one surface to another. Finally, I'm creating a hole using point and axis command. However, doing these takes so much time. I'm wondering if I can automate this process using macros or iFeature. Any help is appreciated. I have attached an example of the part.

 

Thanks!

0 Likes
Accepted solutions (1)
663 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Accepted solution

So I made this code under under a couple assumptions. Your Excel rows are formatted (X,Y,Z) and they are in mm. Corresponding rows in both excel file are a point pair for the axis. I have have the Manifold Points on the Front Plane and the Motor Points on the Back Plane.

 

It only half works at the moment, the Motor Points seem to be placed correctly, but the Manifold points are off. I'm not sure what could be causing this, but I will keep looking into it

 

Annotation 2020-08-05 112917.pngAnnotation 2020-08-05 112945.png

 

Dim oDoc As Document = ThisDoc.Document
Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition

For i = 1 To 102
	
	Dim oFrontSketch As PlanarSketch = oDef.Sketches.Item("Front_Sketch")
	Dim oManiPoint2d As Point2d = ThisApplication.TransientGeometry.CreatePoint2d
	
	oManiPoint2d.X = GoExcel.CellValue("Injector_Manifold_Hole_Pattern.xlsx", "Sayfa1", "A" & i)/10
	oManiPoint2d.Y = GoExcel.CellValue("Injector_Manifold_Hole_Pattern.xlsx", "Sayfa1", "B" & i)/10

	Dim oManiSketchPoint As SketchPoint = oFrontSketch.SketchPoints.Add(oManiPoint2d)
	
	Dim oBackSketch As PlanarSketch = oDef.Sketches.Item("Back_Sketch")
	Dim oMotPoint2d As Point2d = ThisApplication.TransientGeometry.CreatePoint2d
	
	oMotPoint2d.X = GoExcel.CellValue("Injector_Motor_Hole_Pattern.xlsx", "Sayfa1", "A" & i)/10
	oMotPoint2d.Y = GoExcel.CellValue("Injector_Motor_Hole_Pattern.xlsx", "Sayfa1", "B" & i)/10

	Dim oMotSketchPoint As SketchPoint = oBackSketch.SketchPoints.Add(oMotPoint2d)
	
	Dim oAxis As WorkAxis = oDef.WorkAxes.AddByTwoPoints(oManiSketchPoint, oMotSketchPoint)
	Dim oManiPoint As WorkPoint = oDef.WorkPoints.AddByPoint(oManiSketchPoint)
	
	Dim oHoleDef As PointHolePlacementDefinition = oDef.Features.HoleFeatures.CreatePointPlacementDefinition(oManiPoint,oAxis)
	oDef.Features.HoleFeatures.AddDrilledByThroughAllExtent(oHoleDef,.15,PartFeatureExtentDirectionEnum.kSymmetricExtentDirection)
	
Next

  

0 Likes
Message 3 of 4

Anonymous
Not applicable

So after some detective work, I think you posted the wrong coordinates file for the Manifold points and here's why.

 

On the trial part you posted I determined the two holes you made use the points from row 36&37 of Motor coordinates

36 ~ ( -2.08, 29.03)

37 ~ ( -9.62, 36.81)

Which matches with the dimension in inventor, but the corresponding Manifold points do not always match

Inventor 36 ~ (-1.92, 32.59)

Excel 36 ~ (-1.92, 32.59)

 

Inventor 37 ~ (-5.76, 37.91)

Excel 37 ~ (-8.82, 32.90)

 

I couldn't find a row in the Manifold file that matched the coordinates you used in inventor for point 37 in your posted file. It seems the "inner circle" of points match up but anything outside of it doesn't.

0 Likes
Message 4 of 4

boznalbant
Explorer
Explorer

Thank you so much! That's what I exactly needed. I solved that problem by changing the orientation of sketch coordinates and I can modify the code from now on. First I tried your code with VBA editor but then I realized it was for iLogic. I had no problem with iLogic. Thanks again!

0 Likes