Hello
I have an assembly with several parts, including parts that contain curves and points (in 3D sketches).
No one has a lead? I specify that I am on Solidworks 2019 SP5
Thank you
No one has a solution to this problem? I specify that I am on Solidworks 2019 SP5
Maybe with a Solidworks file for example it would be easier to troubleshoot?
Then you just have to see if it works on another version of SW. Or if it's because the file is too large or for some other reason.
And if it is not the file or option but software limitation see with the hotline.
Hello
I am therefore attaching the SW file in question. So I need, in STEP export, the point cloud as well as the curves.
If anyone arrives please explain the procedure to me
Thank you in advance
Hello
Let me take the liberty of reviving this subject. The file in question is attached to my previous answer
Thank you in advance to those who could help me
Hello Aurélien,
I looked at your problem a little bit this morning. For the question of whether SolidWorks allows you to natively export 3D sketch points to a STEP file, the only answer that seems to be valid is that it is not possible.
Since the STEP file is a (non-binary) text file, it is possible to open it with any text editor. And when I open a STEP produced by SolidWorks from your part file, I can't find the coordinates of the points in it.
Now, it is possible to extract the coordinates of the points by a macro like the one proposed on this link: https://forum.solidworks.com/thread/21628#comment-135766
I then had fun doing it and generating a STEP by a Python script (I'm not a fan of VBA macros). Since the definition of the STEP format is in a paid standard, I did it by interpolation from examples of STEP files. The problem is that SolidWorks does not import points from STEP files as physical points. This is probably related to the fact that he cannot differentiate between a single point that should be considered as such and points that define curve endpoints and that should not be taken into account individually.
Importing my generated STEP file will therefore result in an empty part. The same goes for FreeCAD. I then ask myself two questions:
If it works this way, it will be easy to convert my Python script to VBA so that I can use it directly from SW.
Hello
Just a question Why export stitches in step?
You can give them in the form of an Excel table using this macro.
May the force be with you
Hello mgauroy,
First of all, I thank you for the time spent and the tests carried out.
So, I tried to import the files into my metrology software but I didn't have anything, it's empty, like when I try to open on SW. On the other hand, as for your request to have the points exported with creo, it will be difficult. I don't have this software and it's a file sent by a client that I reworked by removing the volumes.
On the other hand, SW is perfectly able to read the points of other STEP files, the proof with the file I sent you.
I can try to see if I can get this point cloud directly in STEP and send it here without reworking it on SW.
By the way, if I'm not mistaken, even in 2D sketching, the point export doesn't work.
Do you think there is a solution?
My greetings
Hello
Simply because I need these points to know where I should come to probe with my 3D control machine. However, the problem is that these points must be linked to the 3D model of the part. Unfortunately the files that I can import to my metrology software is only the STEP format.
So I draw my model, my curves and my points and I export it in STEP. I have to use the different export options to get the curves and the model (2 STEP files) but impossible to get the points.
The license of the metrology software supports several formats including the IGES but unfortunately the option is paid, so I asked the hotline of the software to do a test if with the IGES it works and everything is in order there is everything, model, curves and points moreover with a single file.
We chose the STEP option because one of our customers works with this format and provided us with the volumes (made with Creo) but we didn't anticipate that it wouldn't work with Solidworks. So if I have to make a probing modification I'm annoyed
Hence my question to find a workaround since currently it is not possible to buy the IGES option .
That's it, now I've asked my client to send me, if possible, only the curves to see how it's formatted and to see if we can reproduce this with a macro.
Thanks for the interest
ok I see
I don't know the subject well, I may say something stupid but I say it anyway , is it possible to place a micro sphere at each point?
may the force be with you.
@ OBI WAN
This is not foolishness, quite the contrary.
The problem is that I need my metrology software to be able to interpret it as a point and not a sphere
To illustrate my words, I attach 1 screenshot in my metrology software which shows that I need 2 things. The surface of the model and the point that I use as exat coordinates for taking points. Knowing that this program is shared, it is to make the measurement more reliable, in the event of a change, we can send each other the corrections. My problem is that I can modify his points on SW but I can't save them in STEP.
I know that this is a very specific request but it is quite surprising that exporting to WWTP poses so many problems. Especially since it works for other software.
But I think that the solution proposed by @mgauroy is a solution that needs to be refined
Thanks for the leads
Kind regards
Hello if I understood your client correctly at CREO.
Why don't you send your file to IGES so that it can convert it into a STEP
If I open your SW file under SW and save it in IGES and then I open it in CATIA I can easily save it in STEP.
Hello Franck
It's a possibility indeed but you can understand that for 1 or 2 files it's possible but we're talking about several programs. Working as a subcontractor I need to make intermediate programs that don't directly concern the final product, not to mention that if I want to make a program from A to Z I can't independently. If it was only a few programs I wouldn't have looked for a solution other than the one you list. Not to mention projects for other customers.
I need a viable solution with the means I have at my disposal
Thank you for the answer
Franck
Would it be possible to have the STEP file generated by CATIA? I would like to test if the points appear on my metrology software?
Thank you in advance
Have a great weekend to all
Hello
Can you attach a STEP file generated by Creo (with dots that appear as they should)
Hello
I received the file generated by CREO, I found that in fact the 2nd STEP file generated by mgauroy (6 days ago) was similar to the CREO format. So I looked into why the dots were not displayed on my metrology software and I found that it was actually an option of the software that I had forgotten to activate.
So the file that doesn't contain the lines VERTEX_POINT ('', #1); is readable and usable.
Now I need to be able to create a macro that allows me to extract its points in . STEP for every assembly I do on SW.
If mgauroy can help me or another person it's very happy
Thank you very much
Hello Try this:
Option Explicit
Dim FilePath As String
Dim myPoints As Collection
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
If swModel Is Nothing Then
MsgBox "Ouvrir une pièce"
Exit Sub
End If
If swModel.GetType <> swDocumentTypes_e.swDocPART Then
MsgBox "Ouvrir une pièce"
Exit Sub
End If
swApp.SetUserPreferenceIntegerValue swUserPreferenceIntegerValue_e.swStepAP, 214
swApp.SetUserPreferenceIntegerValue swUserPreferenceIntegerValue_e.swStepExportPreference, swAcisOutputGeometryPreference_e.swAcisOutputAs3DCurves_IncludeSketchEnts
FilePath = Left(swModel.GetPathName, InStrRev(swModel.GetPathName, ".") - 1) & ".STEP"
swModel.Extension.SaveAs2 FilePath, 0, swSaveAsOptions_e.swSaveAsOptions_Silent, Nothing, Empty, False, Empty, Empty
Set myPoints = New Collection
Dim swFeat As SldWorks.Feature
Dim swSubFeat As SldWorks.Feature
Set swFeat = swModel.FirstFeature
While Not swFeat Is Nothing
ProcessFeat swFeat
Set swSubFeat = swFeat.GetFirstSubFeature
While Not swSubFeat Is Nothing
ProcessFeat swSubFeat
Set swSubFeat = swSubFeat.GetNextSubFeature
Wend
Set swFeat = swFeat.GetNextFeature
Wend
UpdateStep Empty
swApp.SetUserPreferenceIntegerValue swUserPreferenceIntegerValue_e.swStepExportPreference, swAcisOutputGeometryPreference_e.swAcisOutputAsSolidAndSurface
End Sub
Sub ProcessFeat(ByVal swFeat As SldWorks.Feature)
Dim swSketch As SldWorks.Sketch
Dim swPt As SldWorks.SketchPoint
Dim vPts As Variant
Dim vPt As Variant
'Debug.Print swfeat.Name & " " & swfeat.GetTypeName2
If swFeat.GetTypeName2 = "ProfileFeature" Or swFeat.GetTypeName2 = "3DProfileFeature" Then
Set swSketch = swFeat.GetSpecificFeature2
vPts = swSketch.GetSketchPoints
For Each vPt In vPts
Set swPt = vPt
If Not swPt Is Nothing Then
If swPt.Type = swSketchPointType_e.swSketchPointType_User Then
myPoints.Add " = CARTESIAN_POINT ( 'NONE', ( " & swPt.X * 1000 & ", " & swPt.Y * 1000 & ", " & swPt.Z * 1000 & " ) ) ;"
End If
End If
Next
End If
End Sub
Sub UpdateStep(void)
Dim myData As String
Dim filenum As Integer
filenum = FreeFile
Debug.Print FilePath
Open FilePath For Binary As #filenum
myData = Space$(LOF(1))
Get #filenum, , myData
Close #filenum
Dim Lines() As String
Lines = Split(myData, vbCrLf)
Dim line As Variant
Dim MaxNum As Integer
For Each line In Lines
If Left(line, 1) = "#" Then
MaxNum = CInt(Mid(line, 2, InStr(line, "=") - 3))
End If
Next
Dim i As Integer
Dim myLines As String
For i = 1 To myPoints.Count
myLines = myLines & "#" & MaxNum + i & myPoints(i) & vbCrLf
Next i
Dim EndString As String
EndString = "ENDSEC;" & vbCrLf & "END-ISO"
myData = Replace(myData, EndString, myLines & EndString)
Open FilePath For Output As #filenum
Print #filenum, myData
Close #filenum
End Sub
Hello Jerome
Thank you for the script, I did a test it works perfectly, On the other hand I can't work directly from an assembly with several part files that have points, is that right? I have to open each piece separately and run the script. It's not a problem in itself but I would have liked to have been able to do as for the rest of the file (volume and curve), namely to display on the screen the parts containing the points and then get a single STEP file with all the points.
Also one thing, the numbering of the points is indicated as NONE, I wish I could name the points as I wanted but I looked on SW and I couldn't find this option. SW gives a number point1, point2, etc. automatically but I would have liked to be able to indicate the name of each point and then during the export in STEP that the name be kept. Is this possible?
In order to illustrate my point, I will put the CREO file that I received from my client. When I try to open it on SW, it tells me that it's an assembly and inside it creates a room with the dots. So I can read the file well with only the dots. You'll see that the dots are all numbered.
Now I am well aware that the request is not simple and even if it is possible but this is what I would like to achieve
In the meantime, I thank you all for the work and especially for the provision of a solution.
Tell me what you think
Thank you
Hello
In fact I realize that I really need this macro to work directly from an assembly otherwise, when I reimport the files, they are not in the right coordinate system and do not fit the part since I am in the local coordinate system and not in the assembly coordinate system.
Is it possible or not?
Thank you