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!

Multiple Holes Normal to Surface Macro 2

Status
Not open for further replies.

jzecha

Aerospace
Jan 20, 2016
235
US
I am looking for a Macro that will create 100+ of the same hole normal to a complex part surface.

I start with hole axises, but I can intersect those with the part surface to create intersection points.
I have searched this forum and found references to PKT license, which I do not have.

I have been running CREO most of this year and I have gotten used to its easy ability to pattern 3D holes.
 
Replies continue below

Recommended for you

Well I am in the process of migrating this code to VBA and updating it with some of the features listed above and have run into a problem.

Does anyone know how to create a hole from an intersection?

I have created planes and intersections for exactly what i want.

I have tried to use this code:
Set hole1 = SF1.AddNewHoleFromPoint(Coord(0), Coord(1), Coord(2), reference4, 10#)

but i can't get it to work correctly.
Can someone tell me how to reference the coordinates from my intersection points?


Here is how i have created my intersection
Set hybridShapeIntersection1 = HSF.AddNewIntersection(reference1, reference2)
 
put a datum point on top of your intersection... and get its' coordinates

...
Dim coord(2)

Dim TheSPAWorkbench As Workbench
Set TheSPAWorkbench = CATIA.ActiveDocument.GetWorkbench("SPAWorkbench")

For Each myHybridShape In hybridBody2.HybridShapes
Set mydatumpoint = hybridShapeFactory1.AddNewPointDatum(myHybridShape)
Dim TheMeasurable As Measurable
Set TheMeasurable = TheSPAWorkbench.GetMeasurable(mydatumpoint)

mydatumpoint.GetCoordinates coord

Dim hybridShapeLineNormal1 As HybridShapeLineNormal​
...

regards,
LWolf
 
Actually, you don't need to create additional datum point, GetCoordinates determine actual geometry automatically.

What you need to do us to call Compute prior to GetCoordinates.
 
I got LWolfs solution to work, thanks for the direction.

Little Cthulhu, I can figure out how to get your solution to work, can you please give me a little direction what I am doing wrong?

Here is a little bit of my code that you might be able to figure out what I am doing wrong.
Current error on the line below states: Object doesn't support this property of method.
"hybridShapeIntersection1.GetCoordinates coord"


Creating the Intersect:
Code:
'Make an Intersect
Set hybridShapeIntersection1 = HSF.AddNewIntersection(reference1, reference2)

'Store the Intersect in the Intersects Geoset
oIntersectsGeoset.AppendHybridShape hybridShapeIntersection1

'Local Update the Intersect
hybridShapeIntersection1.Compute

Trying to Get Coordinates of Intersection:
Code:
Dim coord(2)

Dim TheSPAWorkbench As Workbench
Set TheSPAWorkbench = CATIA.ActiveDocument.GetWorkbench("SPAWorkbench")

Dim TheMeasurable As Measurable
Set TheMeasurable = TheSPAWorkbench.GetMeasurable(hybridShapeIntersection1)

hybridShapeIntersection1.GetCoordinates coord



 
It's TheMeasurable.GetCoordinates

By the way you don't have to put intersection into a geoset to get coordinates.
 
Ok, I feel dumb. I must not know enough to get your direction to work Little Cthulhu.

I tried multiple things to get this to work and no luck.
I currently get Run-time Error 438
Object doesn't support this property or method.

Current Code:
Code:
hybridShapeIntersection1.Compute

Dim coord(2)

Dim TheSPAWorkbench As Workbench
Set TheSPAWorkbench = CATIA.ActiveDocument.GetWorkbench("SPAWorkbench")

Dim TheMeasurable As Measurable
Set TheMeasurable = TheSPAWorkbench.GetMeasurable(hybridShapeIntersection1)

TheMeasurable.GetCoordinates coord

Also, I understand I don't have to put the intersection into the GeoSet, I just use it as a reference how my Code is currently working until I get all the kinks worked out.
I will comment out that line once I get this to work correctly.
 
Hi everyone,,

I was facing some issues in above macro, can you please attach some example 3d model, so that I can clear my doubts,,, please do this needful...
 
What issues are you facing?
I will do what I can to help you out.

I have converted this to VBA, so I have made a bunch of updates to it, but it is still in work.

I am unable to upload the model I used to test this out on because it is customer property.
 
Thanks you jecha,
I have L shape solid model and both side have contour surface, so I have to put holes normal to surface on both side,, what are the inputs required on above macro which you created,, could you please suggest...
FYI:
In my model below data is available
Partbody
Geometrical set (points)
Can you please suggest any other info required to run this macro
 
You will need the following and labeled correctly:

Contour Surface labeled "InputSurface"
Center points for your holes on the InputSurface in a GeoSet labeled "HoleCenterPoints"
PartBody must be called "Holes"

I believe this is all you will need.
 
I can't remember if this macro is able to handle some of the surface/points types.

Try Copying and Pasting Special "As Result" to create an isolated InputSurface and do the same with the Points in your HoleCenterPoints GeoSet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top