Hello
Here's my code:
je le met dans un post suivant car on est limité à 6000 caractères sur le Forum
and output:
So two problems:
1- If I don't define a view in dataView(0), the volume export works, if I define one in the following way:
'Variable pour l'export DXF/DXG
Dim varViews As Variant
Dim dataViews(2) As String
'Vues d'annotation que l'on veux exporter en DXF
dataViews(0) = "*Current"
dataViews(1) = "*Front"
dataViews(2) = "*DXF"
varViews = dataViews
So my export doesn't work anymore...
ElseIf flagTole = 0 Then 'Si on est en volumique:
'value = instance.ExportToDWG2(FilePath, ModelName, Action, ExportToSingleFile, Alignment, IsXDirFlipped, IsYDirFlipped, SheetMetalOptions, Views)
varViews = dataViews
swPart.ExportToDWG2 dxfFilePath, filePath, swExportToDWG_ExportAnnotationViews, False, varAlignment, False, False, 0, varViews
bRet = swPart.ExportToDWG2(dxfFilePath, filePath, swExportToDWG_ExportAnnotationViews, True, varAlignment, False, False, 0, varViews)
If bRet Then
Debug.Print "On a exporté la pièce de volumique en DXF: " & dxfFilePath
Else
Debug.Print ("Erreur enregistrement DXF: " & dxfFilePath)
End If
End If 'Fin du If flagTole
swPart.ExportToDWG2 --> returns FALSE
Even if I only put a front view...
My goal is to create an annotation view called "DXF" in the volume parts that we want to send to cut. Indeed, some are drawn in the context of the assembly and are therefore not centered on the origin, nor on the basic plans and in this case it is appropriate for the draughtsman to choose the view he uses for the cutting. A bit like when you do "Export face" in DXF.
I can't use: swExportToDWG_ExportSelectedFacesOrLoops because I don't think I can find the right face automatically.
(unless I can automatically select the face that has the largest surface area.... but hey it's not great and it may be time-consuming)
2- For sheet metal parts, I export each configuration well, it works cool. On the other hand, I would like to be sure that it uses the geometry of the part in its developed state with the functions that we have associated with the developed state (in the unfolded state folder). Because small modifications are often made only for cutting, for example:
- Small fold marks are added to the end of the folds
- We hide some faces, such as the countersinks that we do in rework, otherwise we end up with a dxf with two concentric circles, and the goal is to have only closed contours.
In my code posted above, I was going through the configurations to find the FLATs, but the sheet metal parts don't have a FLAT configuration until you create the drawing. The use of swExportToDWG suits me well because even if the part doesn't have a flat pattern config, the export is done well.
There you have it, your advice is welcome on the other parts of the code as well.
Thank you very much!