This is great but the caveat is that CATIA V5 recognizes the data to be in metric unites (so, if your model is set to inches, you have to multiply your numbers by 25.4 to get English units before running). Is there a setting that one can select to correct that?
Hi- thanks for your question. Here is a response from our Technical Trainer: Be sure to use the excel spreadsheet that comes along with Catia to import the points. It has the macro built in. It is normally found in the following location: C:\Program Files\Dassault Systemes\Bxx\win_b64\code\command\GSD_PointSplineLoftFromExcel
Hi- Make sure that you have a part file open. Having a Product file or no file at all open will give you different error messages including the one you mentioned. After the Part file is open, run the macro.
Hi Kevin, The quickest solution to this that I am aware of is to convert the macro to inches instead of millimeters directly in the Macro. To do this with the macro open in excel go to View> Macros> View Macros. Select Feuil1.CreationPoint then Edit. Find the code iLigne = iLigne +1 Then Insert
‘convert to inches X= 25.4 * X Y = 25.4 * Y Z = 25.4 * Z Just before ‘Not on a startcurve or endcurve -> valid point Now every time the macro is run what used to be 1mm will now be multiplied by 25.4 and becomes 1in. Hope this helps. Mark P.
In order to make this tool switch to Polylines instead of Splines you would need to edit the VBA Macro inside of the Excel file. One way to do this is to open the Excel file and go to View>Macros>Edit. Inside this you will see a comment that starts with “Creates all usable points, splines and loft from the parameter file”. You will want to make the changes to this code that is displayed below. This gives you the added option of changing the code so POLYLINE can be equal to TRUE or False, and that will control if it creates a polyline or a spline like before. If you are interested in learning more, I recommend our CATIA VB Automation Course. rand3d.com/training/course-descriptions/dassault-systemes/catia-v5/automation Here is the code i mentioned above. Hope this helps! '------------------------------------------------------------------------ ' Creates all usable points and splines from the parameter file '------------------------------------------------------------------------ '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 'Limitations: ' ============================> NO MORE THAN 500 POINTS PER SPLINE '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #Const POLYLINE = True ' If True -> Polyline is created, False -> Spline Sub CreationSpline() 'Limitation : points per spline Const NBMaxPtParSpline As Integer = 500
'Get CATIA Dim PtDoc As Object Set PtDoc = GetCATIAPartDocument
'Get HybridBody Dim myHBody As Object Set myHBody = PtDoc.Part.HybridBodies.Item("GeometryFromExcel")
Dim iRang As Integer Dim iValid As Integer Dim X1 As Double Dim Y1 As Double Dim Z1 As Double Dim index As Integer Dim PassingPtArray(1 To NBMaxPtParSpline) As Object Dim spline As Object Dim ReferenceOnPoint As Object Dim SplineCtrPt As Object
'reinitialization of point array of the spline index = 0
'Remove records before StartCurve While ((iValid Cst_iSTARTCurve) And (iValid Cst_iEND)) ChainAnalysis iRang, X1, Y1, Z1, iValid iRang = iRang + 1 Wend
If (iValid Cst_iEND) Then 'Read until endcurve -> Spline completed While ((iValid Cst_iENDCurve) And (iValid Cst_iEND)) ChainAnalysis iRang, X1, Y1, Z1, iValid iRang = iRang + 1
'valid point If (iValid = 0) Then index = index + 1 If (index > NBMaxPtParSpline) Then MsgBox "Too many points for a spline. Point deleted" Else Set PassingPtArray(index) = PtDoc.Part.HybridShapeFactory.AddNewPointCoord(X1, Y1, Z1) myHBody.AppendHybridShape PassingPtArray(index) End If End If Wend
'Start building spline 'Are there enough points ? If (index < 2) Then MsgBox "Not enough points for a spline. Spline deleted" Else #If POLYLINE Then ' new polyline Set spline = PtDoc.Part.HybridShapeFactory.AddNewPolyline
'Adds points to the polyline For i = 1 To index Set ReferenceOnPoint = PtDoc.Part.CreateReferenceFromObject(PassingPtArray(i)) spline.InsertElement ReferenceOnPoint, i ' optionally, set the radius. In this case, we just set it to 20mm If i > 1 And i < index Then ' start and end point not included spline.SetRadius i, 20 End If Next i #Else ' new spline Set spline = PtDoc.Part.HybridShapeFactory.AddNewSpline spline.SetSplineType 0 spline.SetClosing 0
'Creates and adds points to the spline For i = 1 To index Set ReferenceOnPoint = PtDoc.Part.CreateReferenceFromObject(PassingPtArray(i)) ' ---- Version Before V5R12 ' Set SplineCtrPt = PtDoc.Part.HybridShapeFactory.AddNewControlPoint(ReferenceOnPoint) ' spline.AddControlPoint SplineCtrPt
' ---- Since V5R12 spline.AddPointWithConstraintExplicit ReferenceOnPoint, Nothing, -1, 1, Nothing, 0 Next i
#End If myHBody.AppendHybridShape spline End If End If Wend
This also worked on the more recent 3D Experience for me. And I have to say I appreciate this video a lot as it has helped me in my project.
this is excellent! never knew it. thanks
now to try putting it within an impeller geometry
Thank you sir
It was very helpful
Hi ! Thanks for the video. Is it possible to realise the same task in 2D, within a particular sketch (with 2 columns of coordinates) ?
This is great but the caveat is that CATIA V5 recognizes the data to be in metric unites (so, if your model is set to inches, you have to multiply your numbers by 25.4 to get English units before running). Is there a setting that one can select to correct that?
Hi! I've created an Excel file and created a CATIA part, but View > Macros doesn't show that I have any macros. How did you get to that stage?
Hi- thanks for your question. Here is a response from our Technical Trainer:
Be sure to use the excel spreadsheet that comes along with Catia to import the points. It has the macro built in. It is normally found in the following location:
C:\Program Files\Dassault Systemes\Bxx\win_b64\code\command\GSD_PointSplineLoftFromExcel
Hello,
After giving input 1 in box, it shows, 'object doesn't support this property or method' ,
what should i do for this?
Hi- Make sure that you have a part file open. Having a Product file or no file at all open will give you different error messages including the one you mentioned. After the Part file is open, run the macro.
I have the same error
Maybe it's so late,but if you have the same problem, watch th-cam.com/video/K6j_9-3VjuM/w-d-xo.html
Cool thanks. I tried without paying attention. Didn't work till I used the main macro. Main Macro folks.
Hi, i try this but it seem to be in difference unit, I want import as inch but the points look lot closer than it should. THanks
Hi Kevin,
The quickest solution to this that I am aware of is to convert the macro to inches instead of millimeters directly in the Macro. To do this with the macro open in excel go to View> Macros> View Macros.
Select Feuil1.CreationPoint then Edit.
Find the code
iLigne = iLigne +1
Then Insert
‘convert to inches
X= 25.4 * X
Y = 25.4 * Y
Z = 25.4 * Z
Just before
‘Not on a startcurve or endcurve -> valid point
Now every time the macro is run what used to be 1mm will now be multiplied by 25.4 and becomes 1in.
Hope this helps.
Mark P.
How to connect with polyline instead of spline?
In order to make this tool switch to Polylines instead of Splines you would need to edit the VBA Macro inside of the Excel file. One way to do this is to open the Excel file and go to View>Macros>Edit. Inside this you will see a comment that starts with “Creates all usable points, splines and loft from the parameter file”. You will want to make the changes to this code that is displayed below. This gives you the added option of changing the code so POLYLINE can be equal to TRUE or False, and that will control if it creates a polyline or a spline like before. If you are interested in learning more, I recommend our CATIA VB Automation Course.
rand3d.com/training/course-descriptions/dassault-systemes/catia-v5/automation
Here is the code i mentioned above. Hope this helps!
'------------------------------------------------------------------------
' Creates all usable points and splines from the parameter file
'------------------------------------------------------------------------
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
'Limitations:
' ============================> NO MORE THAN 500 POINTS PER SPLINE
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#Const POLYLINE = True ' If True -> Polyline is created, False -> Spline
Sub CreationSpline()
'Limitation : points per spline
Const NBMaxPtParSpline As Integer = 500
'Get CATIA
Dim PtDoc As Object
Set PtDoc = GetCATIAPartDocument
'Get HybridBody
Dim myHBody As Object
Set myHBody = PtDoc.Part.HybridBodies.Item("GeometryFromExcel")
Dim iRang As Integer
Dim iValid As Integer
Dim X1 As Double
Dim Y1 As Double
Dim Z1 As Double
Dim index As Integer
Dim PassingPtArray(1 To NBMaxPtParSpline) As Object
Dim spline As Object
Dim ReferenceOnPoint As Object
Dim SplineCtrPt As Object
iValid = 0
iRang = 1
'Analyze file
While iValid Cst_iEND
'reinitialization of point array of the spline
index = 0
'Remove records before StartCurve
While ((iValid Cst_iSTARTCurve) And (iValid Cst_iEND))
ChainAnalysis iRang, X1, Y1, Z1, iValid
iRang = iRang + 1
Wend
If (iValid Cst_iEND) Then
'Read until endcurve -> Spline completed
While ((iValid Cst_iENDCurve) And (iValid Cst_iEND))
ChainAnalysis iRang, X1, Y1, Z1, iValid
iRang = iRang + 1
'valid point
If (iValid = 0) Then
index = index + 1
If (index > NBMaxPtParSpline) Then
MsgBox "Too many points for a spline. Point deleted"
Else
Set PassingPtArray(index) = PtDoc.Part.HybridShapeFactory.AddNewPointCoord(X1, Y1, Z1)
myHBody.AppendHybridShape PassingPtArray(index)
End If
End If
Wend
'Start building spline
'Are there enough points ?
If (index < 2) Then
MsgBox "Not enough points for a spline. Spline deleted"
Else
#If POLYLINE Then
' new polyline
Set spline = PtDoc.Part.HybridShapeFactory.AddNewPolyline
'Adds points to the polyline
For i = 1 To index
Set ReferenceOnPoint = PtDoc.Part.CreateReferenceFromObject(PassingPtArray(i))
spline.InsertElement ReferenceOnPoint, i
' optionally, set the radius. In this case, we just set it to 20mm
If i > 1 And i < index Then ' start and end point not included
spline.SetRadius i, 20
End If
Next i
#Else
' new spline
Set spline = PtDoc.Part.HybridShapeFactory.AddNewSpline
spline.SetSplineType 0
spline.SetClosing 0
'Creates and adds points to the spline
For i = 1 To index
Set ReferenceOnPoint = PtDoc.Part.CreateReferenceFromObject(PassingPtArray(i))
' ---- Version Before V5R12
' Set SplineCtrPt = PtDoc.Part.HybridShapeFactory.AddNewControlPoint(ReferenceOnPoint)
' spline.AddControlPoint SplineCtrPt
' ---- Since V5R12
spline.AddPointWithConstraintExplicit ReferenceOnPoint, Nothing, -1, 1, Nothing, 0
Next i
#End If
myHBody.AppendHybridShape spline
End If
End If
Wend
PtDoc.Part.Update
End Sub