Search found 19 matches

by chancegarrison
Thu Dec 12, 2024 10:03 pm
Forum: Macro Library
Topic: Access to Component "File Properties" Through Assembly & Drawing Without Opening the Component
Replies: 2
Views: 1278

Re: Access to Component "File Properties" Through Assembly & Drawing Without Opening the Component

Hello everyone, Basically a macro for the subject says. I searched the forum library but could not find something similar. I have Custom Properties setup which is great but it does not work in drawings environment o[ . This forces me to switch back & forth a lot when I want to change properties...
by chancegarrison
Wed Dec 11, 2024 4:22 pm
Forum: How To Questions
Topic: Change multi-sheet DWG export names
Replies: 1
Views: 155

Change multi-sheet DWG export names

Does anyone know how to change the default naming when exporting multi-sheet DWG's?
image.png
by chancegarrison
Mon Dec 09, 2024 3:37 pm
Forum: Macro Library
Topic: Macro help to display part of filename
Replies: 9
Views: 915

Re: Macro help to display part of filename

Replace this line Set swCustPropMgr = swModel.Extension.CustomPropertyManager("Default") with If swModel.GetType = 3 Then Set swCustPropMgr = swModel.Extension.CustomPropertyManager("") Else Set swCustPropMgr = swModel.Extension.CustomPropertyManager("Default") End If ...
by chancegarrison
Sun Nov 24, 2024 5:40 pm
Forum: Macro Library
Topic: Macro help to display part of filename
Replies: 9
Views: 915

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...
by chancegarrison
Sun Nov 24, 2024 5:13 pm
Forum: Macro Library
Topic: Macro help to display part of filename
Replies: 9
Views: 915

Re: Macro help to display part of filename

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.
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.
by chancegarrison
Sun Nov 24, 2024 5:01 pm
Forum: Macro Library
Topic: Macro help to display part of filename
Replies: 9
Views: 915

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...
by chancegarrison
Fri Nov 22, 2024 9:57 pm
Forum: Macro Library
Topic: Macro help to display part of filename
Replies: 9
Views: 915

Re: Macro help to display part of filename

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, "-"))
Alex, this would be great but I’m no coder.
by chancegarrison
Fri Nov 22, 2024 6:38 pm
Forum: Macro Library
Topic: Macro help to display part of filename
Replies: 9
Views: 915

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?...
by chancegarrison
Fri Nov 22, 2024 1:28 pm
Forum: Macro Library
Topic: Batch file renaming with filters (Pack and Go)
Replies: 2
Views: 410

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...
by chancegarrison
Thu Nov 14, 2024 3:10 pm
Forum: Macro Library
Topic: Automated part numbering
Replies: 6
Views: 942

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 ...
by chancegarrison
Tue Nov 12, 2024 11:59 am
Forum: Macro Library
Topic: Automated part numbering
Replies: 6
Views: 942

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...
by chancegarrison
Tue Nov 12, 2024 9:03 am
Forum: Macro Library
Topic: Automated part numbering
Replies: 6
Views: 942

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...
by chancegarrison
Mon Nov 11, 2024 1:16 pm
Forum: Macro Library
Topic: Split macro
Topic: Split macro
Replies: 13
Views: 1972

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...
by chancegarrison
Tue Aug 15, 2023 2:45 pm
Forum: API
Topic: Pack and Go Lite macro
Replies: 6
Views: 2251

Re: Pack and Go Lite macro

mihkov wrote: Fri Aug 11, 2023 7:59 am Perfect example. Didn't see that there is one.

Code: Select all

swPackAndGo.IncludeDrawings = True
Where does this line need to be added?
by chancegarrison
Thu Aug 10, 2023 12:02 pm
Forum: API
Topic: Pack and Go Lite macro
Replies: 6
Views: 2251

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...
by chancegarrison
Thu Aug 10, 2023 9:59 am
Forum: API
Topic: Pack and Go Lite macro
Replies: 6
Views: 2251

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.
by chancegarrison
Wed Feb 08, 2023 1:50 pm
Forum: Macro Library
Topic: Hide all reference geometry (Blank Datums)
Replies: 10
Views: 2726

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....
by chancegarrison
Thu Feb 02, 2023 11:13 am
Forum: Macro Library
Topic: Hide all reference geometry (Blank Datums)
Replies: 10
Views: 2726

Re: Hide all reference geometry (Blank Datums)

AlexB wrote: Thu Feb 02, 2023 10:49 am What does the error say?

Going with a guess, it could be that a component is lightweight or something unexpected. I'd have to do a bit of testing to figure that out.
image.png
by chancegarrison
Thu Feb 02, 2023 8:11 am
Forum: Macro Library
Topic: Hide all reference geometry (Blank Datums)
Replies: 10
Views: 2726

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...