Search found 16 matches
- Sun Nov 24, 2024 5:40 pm
- Forum: Macro Library
- Topic: Macro help to display part of filename
- Replies: 6
- Views: 325
Re: Macro help to display part of filename
Here is another version, it can be simplified but I prefer it. Option Explicit Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim FileName As String Sub main() Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc FileName = swModel.GetPathName FileName = Mid(FileName, In...
- Sun Nov 24, 2024 5:13 pm
- Forum: Macro Library
- Topic: Macro help to display part of filename
- Replies: 6
- Views: 325
Re: Macro help to display part of filename
I should add that ideally I could run the macro and have it plug into a custom property value (ex PRP: "End of filename") so I could run this across hundreds of drawings.chancegarrison wrote: ↑Sun Nov 24, 2024 5:01 pm Deepak,
How is this code intended to be used? I run this but nothing happens that I can see.
- Sun Nov 24, 2024 5:01 pm
- Forum: Macro Library
- Topic: Macro help to display part of filename
- Replies: 6
- Views: 325
Re: Macro help to display part of filename
Here is another version, it can be simplified but I prefer it. Option Explicit Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim FileName As String Sub main() Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc FileName = swModel.GetPathName FileName = Mid(FileName, In...
- Fri Nov 22, 2024 9:57 pm
- Forum: Macro Library
- Topic: Macro help to display part of filename
- Replies: 6
- Views: 325
Re: Macro help to display part of filename
Alex, this would be great but I’m no coder.AlexB wrote: ↑Fri Nov 22, 2024 9:12 pm Try this. The variable "s" is your initial string.Code: Select all
Dim substring As String substring = Right(s, Len(s) - InStrRev(s, "-"))
- Fri Nov 22, 2024 6:38 pm
- Forum: Macro Library
- Topic: Macro help to display part of filename
- Replies: 6
- Views: 325
Macro help to display part of filename
I am looking for help to display part of a file name that is after a certain number of characters or a dash symbol. For example, I have a part with file name 1-123456-001 I want to be able to display only the 001 from the end after the second dash on a drawing. How can this be trimmed and displayed?...
- Fri Nov 22, 2024 1:28 pm
- Forum: Macro Library
- Topic: Batch file renaming with filters (Pack and Go)
- Replies: 2
- Views: 236
Batch file renaming with filters (Pack and Go)
Hi Guys, I recently had the need to rename a bunch of files and have always used pack-and-go for this type of work, but it left me with something to desire. Does anyone have a macro that can filter out the renaming function based on file type? For instance, I need to rename only assembly files and t...
- Thu Nov 14, 2024 3:10 pm
- Forum: Macro Library
- Topic: Automated part numbering
- Replies: 6
- Views: 572
Re: Automated part numbering
Check the macro by @artem here https://www.youtube.com/watch?v=tgRB8YtB4v4 Thanks Deepak! Would it be possible to add a prompt to pop up when running the macro that allowed the user to input these values? That would be exactly what im looking for. The user would click save, be prompted to select a ...
- Tue Nov 12, 2024 11:59 am
- Forum: Macro Library
- Topic: Automated part numbering
- Replies: 6
- Views: 572
Re: Automated part numbering
You could set up a simple macro that checks the last number used in the format and adds 1 to it. For example, it could search for the highest number in your project (like XYZ-000-002), then prompt you for the prefix (XYZ-000-) and auto-generate the next number (XYZ-000-003). If you're using Excel o...
- Tue Nov 12, 2024 9:03 am
- Forum: Macro Library
- Topic: Automated part numbering
- Replies: 6
- Views: 572
Automated part numbering
Hello friends, Does anyone know of a macro that automates part numbering? It would be awesome to have a macro that selects the next available part number that you could input on the fly that also stores the previous input until changed. For example, I make a new part for project XYZ-000. There are a...
- Mon Nov 11, 2024 1:16 pm
- Forum: Macro Library
- Topic: Split macro
- Replies: 12
- Views: 1096
Re: Split macro
In SW2025 this will be much easier because you can then pattern reference geometry. Attached is a library feature to help automate this a bit in the meantime. Drag the feature into your part, select the top plane or face of the part, then the bottom plane or face, then any plane that runs through th...
- Tue Aug 15, 2023 2:45 pm
- Forum: API
- Topic: Pack and Go Lite macro
- Replies: 6
- Views: 1915
Re: Pack and Go Lite macro
Where does this line need to be added?mihkov wrote: ↑Fri Aug 11, 2023 7:59 am Perfect example. Didn't see that there is one.Code: Select all
swPackAndGo.IncludeDrawings = True
- Thu Aug 10, 2023 12:02 pm
- Forum: API
- Topic: Pack and Go Lite macro
- Replies: 6
- Views: 1915
Re: Pack and Go Lite macro
I don't know of a function that can find out which drawing an assembly or part file refers to without opening that assembly or part file. It can be assumed that the drawing has exactly the same name as the assembly or part, and look for such files and, if they exist, copy them. But this is a rather...
- Thu Aug 10, 2023 9:59 am
- Forum: API
- Topic: Pack and Go Lite macro
- Replies: 6
- Views: 1915
Re: Pack and Go Lite macro
Would it be possible to make a version of this that includes the drawings? This would become very useful if so.
- Wed Feb 08, 2023 1:50 pm
- Forum: Macro Library
- Topic: Hide all reference geometry (Blank Datums)
- Replies: 10
- Views: 2411
Re: Hide all reference geometry (Blank Datums)
Add this IF statement above the highlighted line in your error image. If mCompModelDoc(swChildComp) Is Nothing Then swChildComp.SetSuppression2 swComponentSuppressionState_e.swComponentFullyResolved End If Still sometimes receiving an error on some assemblies, but i'm not sure why. image.png image....
- Thu Feb 02, 2023 11:13 am
- Forum: Macro Library
- Topic: Hide all reference geometry (Blank Datums)
- Replies: 10
- Views: 2411
- Thu Feb 02, 2023 8:11 am
- Forum: Macro Library
- Topic: Hide all reference geometry (Blank Datums)
- Replies: 10
- Views: 2411
Re: Hide all reference geometry (Blank Datums)
@jcapriotti , I updated the file in my previous post with one that seems to work better on assemblies as well. For read-only files, any changes will be skipped (this assumes these files are checked-in and cannot be changed anyway). There is a prompt that asks for permission to open then close files...