Showing results for
Do you mean
Solved!

# Fast Way to Intersect Curves with Surface to create Mesh Points?

I have a surface, and I have curves normal to the surface which also intersect the surface.  I would like to create mesh points on the surface at the intersection locations. Currently the method I'm using is:

Create Points at intersection:

Geometry > Point > (Method: Intersect Curve/Surface), then I individually select one curve and the surface.

Create Mesh Points on Surface:

Mesh > Mesh Control > Mesh Points on Surface

(I do understand that in the automatic meshing dialog box for surfaces there is a selection to include internal points as mesh locations)

Is there a better method? I would like to select all the curves and the surface and in one click create points at the intersection.

Thank you all for your help.

6 REPLIES
Solution
Solution
Accepted by topic author Stressman
‎08-26-2015 04:32 AM

## Re: Fast Way to Intersect Curves with Surface to create Mesh Points?

API programming is one solution

Launch this in the API window.

AP

```Sub Main
Dim App As femap.model
Set App = feFemap()

Dim p1(2) As Double, p2 As Variant

Dim cSet As femap.Set, s As femap.Surface
Dim p As femap.Point

Set cSet = App.feSet
Set s = App.feSurface
Set p = App.fePoint

If cSet.Select(FT_CURVE,False,"Select curves") = FE_CANCEL Then End
If s.SelectID("Select surface") = FE_CANCEL Then End

While cSet.Next
If App.feCoordSurfaceIntersect(cSet.CurrentID,s.ID,p1,p2) <> FE_FAIL Then
p.xyz = p2
p.Put(p.NextEmptyID)
Else
App.feAppMessage(FCM_ERROR,"Could not find intersection for curve #" & CStr(cSet.CurrentID))
End If
Wend
End Sub```

## Re: Fast Way to Intersect Curves with Surface to create Mesh Points?

Dear Genius, ie, Astrium!,

The macro runs perfectly, thanks for sharing!.

Best regards,

Blas.

Blas Molero Hidalgo, Ingeniero Industrial, Director
IBERISA • 48004 BILBAO (SPAIN)
WEB: http://www.iberisa.com
Blog Femap-NX Nastran: http://iberisa.wordpress.com/

## Re: Fast Way to Intersect Curves with Surface to create Mesh Points?

For those of us who don't understand API programming just yet, would a curve break using the surface-curve intersection work? then the mesh would automatically pick up the break and mesh accordingly?

Also if anyone has an API tutorial im sure there would be lots, including myself, who wouldnt mind learning the basics.

Brett

## Re: Fast Way to Intersect Curves with Surface to create Mesh Points?

Dear Brett,

You can try yourself. Here you are a simply example of a few curves intersecting a surface:

Next run the API from ASTRIUM or create "manually" a point at the intersection of each curve with the surface, here you are the result:

You have the points, next I would perform the following in FEMAP:

• Command "MODIFY > BREAK" to split curve at the previous computed intersecting points with the surface, repeat one by one.
• Issue command "Mesh > Mesh Control > Mesh Points on Surface" to define specific locations on the surface where nodes will be created when the surface is meshed. Because we have already created points on the surface at the locations, choose "Use Existing Points".

And here we are the final mesh of the surface:

Best regards,

Blas.

Blas Molero Hidalgo, Ingeniero Industrial, Director
IBERISA • 48004 BILBAO (SPAIN)
WEB: http://www.iberisa.com
Blog Femap-NX Nastran: http://iberisa.wordpress.com/

## Re: Fast Way to Intersect Curves with Surface to create Mesh Points?

Wonderful, thank you for the demo and the API code. You folks are awesome!

## Re: Fast Way to Intersect Curves with Surface to create Mesh Points?

[ Edited ]

I just found this post and found the script tremendously helpful. I had an application that needed to blend all of these options together, so I added to the script to add some more functionality. I've added the option to select multiple curves and surfaces, create a group from the newly created points, break the curves at the points, and add the points as mesh points to the intersected surfaces. Hopefully, someone else will find this useful.

```Sub Main
Dim App As femap.model
Set App = feFemap()

Dim tracker As femap.TrackData
Set tracker = App.feTrackData

Dim p1(2) As Double
Dim p2 As Variant
Dim newPointID As Long

Dim cSet As femap.Set
Dim s As femap.Surface
Dim p As femap.Point
Dim sSet As femap.Set

Dim createdPoints As femap.Set
Set createdPoints = App.feSet

Set cSet = App.feSet
Set sSet = App.feSet
Set s = App.feSurface
Set p = App.fePoint

' Prompt to select surfaces and curves
If sSet.Select(FT_SURFACE, False, "Select surfaces") = FE_CANCEL Then
Exit Sub
ElseIf cSet.Select(FT_CURVE,False,"Select curves") = FE_CANCEL Then
Exit Sub
End If

' Prompt user for options
Begin Dialog UserDialog 280,105,"Intersection Point Options" ' %GRID:10,7,1,1
OKButton 40,77,90,21
CancelButton 150,77,90,21
CheckBox 20,14,240,14,"Create group from created points",.groupPoints
CheckBox 20,35,220,14,"Add points to surface mesh",.meshPoints
CheckBox 20,56,230,14,"Break curves at points",.breakCurves
End Dialog
Dim dlg As UserDialog
Dialog dlg

' Begin tracking created points
tracker.Start(3)

' Create points
Do While s.NextInSet(sSet.ID)
While cSet.Next
If App.feCoordSurfaceIntersect(cSet.CurrentID,s.ID,p1,p2) <> FE_FAIL Then
'Create point
p.xyz = p2
newPointID = p.NextEmptyID
p.Put(newPointID)

' Add point as mesh point to surface
If dlg.meshPoints And s.AddMeshPoint(newPointID) = FE_INVALID Then
App.feAppMessage(FCM_ERROR, "Maximum number of mesh points for surface has been exceeded")
End If

' break curve at point
If dlg.breakCurves Then
App.feCurveBreak(cSet.CurrentID, p.xyz)
End If
End If
Wend
cSet.Reset
Loop

' Report number of points created
tracker.Stop(3)
If tracker.Created(3, createdPoints.ID, False) = FE_NOT_AVAILABLE Then
App.feAppMessage(FCM_ERROR, "None of the selected curves intersect with the selected surfaces.")
Else
App.feAppMessage(FCM_NORMAL, createdPoints.Count() & " Point(s) created...")

' Add created points to group
If dlg.groupPoints Then
Dim grp As femap.Group
Set grp = App.feGroup

' Create group