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.
Solved! Go to Solution.
API programming is one solution
Launch this in the API window.
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
Dear Genius, ie, Astrium!,
The macro runs perfectly, thanks for sharing!.
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.
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:
And here we are the final mesh of the surface:
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 grp.SetAdd(FT_POINT, createdPoints.ID) grp.title = "Points from Surface-Curve Intersections" grp.Put(grp.NextEmptyID) App.feAppMessage(FCM_NORMAL, "Group created...") End If End If End Sub