Automatically assign next part number to SOLIDWORKS file using macro

Поділитися
Вставка
  • Опубліковано 28 жов 2024

КОМЕНТАРІ • 22

  • @gryn1s
    @gryn1s 3 роки тому

    nice nice nice, you deserve a medal kind sir

  • @prashantmandlik8866
    @prashantmandlik8866 Рік тому +1

    Excellent Video.
    This Macro is only generating new no for new parts. but what about existing parts which we have alrady created?
    can we rename existing part to next counter with this macro?

  • @TheJLC91
    @TheJLC91 4 роки тому +1

    Excellent video!
    Can the first Macro be modified to run regardless of whether the part is new or saved? I would like to be able to serialize any part manually.

    • @CodeStackDev
      @CodeStackDev  4 роки тому

      Thank you, John. Do you mean you want to rename existing part as changing the title would require that, unless I missing your question. If so, do you have this part linked to assemblies or drawings so you need to relink the file references? The answer is Yes, possible, just may be more complicated if you need to redo references.

    • @tjeenkwillink
      @tjeenkwillink 3 роки тому +1

      @@CodeStackDev I agree this would be a great feature. My goal is to do a "Save as copy". So instead of drafting a new part from scratch, just open a similar part, give it a new number and modify the file. I assume this would not be difficult to add to the code. How should I modify the code to achieve this?

  • @guntis3716
    @guntis3716 2 роки тому

    Hey man can you help me? I'm stuck on LoadMacroRunner, it shows run-time error '424' Object required when i create new part. I can manually generate new part names but can't automaticly. After error it takes me to line ( Set swApp = aplication.SldWorks )

  • @JarvJarvBinks
    @JarvJarvBinks 4 роки тому

    Excellent tutorial!
    Is there a way to integrate the numbering system when using Pack and Go as well? For example, if a project has parts PRT-001, PRT-002, PRT-003, etc... is there away to have those numbers automatically grab the next numbers in sequence from the prt.txt file? So if the next available number was 77, the new file names would become PRT-077, PRT-078, PRT-079. My company does not use PDM and we frequently use the SolidWorks Pack and Go functionality. Thanks!

    • @CodeStackDev
      @CodeStackDev  4 роки тому

      It would be possible, but it is better to have this as an add-in. I'm currently working on a generic tool for CAD, please contact me at info@xarial.com for more information.

  • @RobEdwards369
    @RobEdwards369 5 років тому +1

    Thankyou :)

  • @martinmarkovmm
    @martinmarkovmm 2 роки тому

    Great tutorial, last part with auto starting solidworks with macro already on didn't work for me...

  • @mechporn
    @mechporn 2 роки тому

    Hi thank you for great vedio, is there any reason that i can not have more than 6 digits, i want the numbering starts 700000, and it shows an error ''Run-time error '6''' Overflow

  • @valbressi17
    @valbressi17 4 роки тому

    This is GREAT!! Thank you! The only question I have is how can I add a suffix to the part file? For example, I want my parts to always end in "R00". THANKS!

    • @CodeStackDev
      @CodeStackDev  4 роки тому

      Just modify the line as follow:
      name = BASE_NAME & Format(thisNumber, NMB_FORMAT) & "R00"

    • @valbressi17
      @valbressi17 4 роки тому

      @@CodeStackDev THANKS! I actually managed to figure it out. It works perfectly to rename but we're having issues where many Solidworks boxes are greyed out. I've come to realize this happens only when the the macro is loaded automatically when SW starts (with modified /m property). Running the macro once inside SW is fine. To test, when I start SW with the /m modified shortcut, create a new part file, click on the "file properties" button between the REBUILD and options gear, then close that properties box, it stays greyed out. I need to click the options gear and then close that and then I have access to everything else. I notice parts are having a "locked" issue as well. Still trying to trace the issue. Not sure if the model is locked
      (I tried adding an unlock code) or file properties doesn't like something. :(

    • @valbressi17
      @valbressi17 4 роки тому

      Yes, I've just confirmed repeatedly that if I run the macro manually, SW menus are NOT greyed-out and perform normally. Once I run the macro that checks for new parts in the background, things get weird. Is the code missing something? Another check is that if I close all open drawings (but keep SW running), I should have the choice to click the menu icons for NEW, etc. They are greyed-out if using the /m shortcut. ANY help you can provide would be GREATLY appreciated!!!

    • @valbressi17
      @valbressi17 4 роки тому

      Sketching a quick circle, extruding, then adding a fillet to one edge. Once I click OK to end the fillet, all the items in the "FEATURES" tab are greyed out. Stopping the script, everything returns to normal.

    • @valbressi17
      @valbressi17 4 роки тому

      I believe I have found the issue. I thought it was the macro running in the background looking for new files that was the problem, but I believe it was the actual renaming macro. I added the word END on the line before END SUB and now everything works perfectly so far!

  • @EoinH100
    @EoinH100 5 років тому

    Hi, Great Video,
    I am having an issue with entering the code.
    I am getting a run-time error '53'
    File not found:
    Any idea how to fix this?
    Thanks for feedback

    • @CodeStackDev
      @CodeStackDev  5 років тому

      Hi Eoin, thank you. Please make sure that the file path you have specified in the NMB_SRC_FILE_PATH exists on a disk and can be accessed.

  • @QuintusAndreus
    @QuintusAndreus 5 років тому +1

    Very cute

  • @PrvKmr7989
    @PrvKmr7989 3 роки тому

    it was good video but I am facing an Issue .Anyone Please help me in figuring out in below line
    Open filePath For Input As #fileNo
    which I am getting in the code.