Hello
Is it possible to retrieve the creation tree from sw2023 in text file form? Thank you for your answers.
Hello
Not to my knowledge, but surely others will have tricks.
On the other hand, out of curiosity, may I ask you the reason?
The creation tree of a room?
An assembly (nomenclature?)
Please specify request if possible.
I'm also interested, I would need to share native files but with different SW versions
If anyone knows how to automate either the transcription of the tree to text or the screenshot of the functions in stages
Hello;
Some avenues to explore here: (JAVA Script)
or here (but they are a little dated:
Kind regards
Hello
Indeed, it is the tree of creation of an assembly. Thank you.
Hello
Try this code in C# to extract the names of the tree's functions in an assembly:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;
using SolidWorks.Interop.sldworks;
using SolidWorks.Interop.swconst;
using System.IO;
namespace Lecture_Arbre_Assemblage
{
public partial class SolidWorksMacro
{
public void Main()
{
ModelDoc2 swDoc = null;
Feature swFeat = null;
swDoc = ((ModelDoc2)(swApp.ActiveDoc));
swFeat = (Feature)swDoc.FirstFeature();
string path = @"C:\Users\tm\Documents\tree.txt";
File.Delete(path);
string featType;
string featName = swFeat.GetNameForSelection(out featType);
while (swFeat != null)
{
featName = swFeat.GetNameForSelection(out featType);
if(featType == "SKETCH")
File.AppendAllText(path, "\t" + featName + "\r");
else
File.AppendAllText(path, featName + "\r");
swFeat = (Feature)swFeat.GetNextFeature();
}
}
// The SldWorks swApp variable is pre-assigned for you.
public SldWorks swApp;
}
}
You need to modify this line of code to specify the location of the file:
string path = @" C:\Users\tm\Documents\tree.txt ";
As an attachment is the file that has been released. This is only a draft, there are many possibilities depending on the needs.
tree.txt (377 bytes)
Kind regards
Hello
Thank you for your answer. For my part, I ended up using this utility:
It's slow, but it meets my need.
Hello @mw1free ,
Late response...
Although very old, the macro indicated above by @Maclane works perfectly on a part or assembly. Its only disadvantage is that it does not offer any filters for import, which generates a very complete document, but very confusing.
The proposed evolution incorporates 3 filters:
- a depth of exploration of the tree;
- a list of checkboxes to define which objects in the tree to ignore;
- A list of check boxes to set the properties of components to display (assemblies).
Kind regards.
CopyFeatureTree.swp (141.5 KB)
CopyFeatureTree.pdf (196.4 KB)
Cool!!!
Thank you for these welcome developments @m.blt ... and with a nice manual as a bonus, classy!