API help needed

Programming and macros
abikic
Posts: 5
Joined: Fri Dec 06, 2024 1:56 am
Answers: 0

API help needed

Unread post by abikic »

Hi! I have to write a macro for my work and I can't get it to work, so if anyone could help me, I would be grateful.

For eg, an electrical drawing has multiple PMAs such as PMA17-100, PMA12-200, PMA17-500 etc. I need to write a macro that will firstly make a pop up box, msgbox, that will list the PMAs for eg: 2 PMA17: 100,500 , 1 PMA12-200. Also, I need it to then make a table in a drawing (next to where there is part name etc.) and in the first column it willl list PMA17 and PMA12 and then in the second column it would sum the numbers after - if the numbers after PMA are the same (for eg PMA17: 600, PMA12: 200). I am stuck on this for days, I can't even find the macro that does something similar so any help is reallllly needed :)
User avatar
josh
Posts: 304
Joined: Thu Mar 11, 2021 1:05 pm
Answers: 16
x 22
x 514

Re: API help needed

Unread post by josh »

Is this for SolidWorks Electrical?
abikic
Posts: 5
Joined: Fri Dec 06, 2024 1:56 am
Answers: 0

Re: API help needed

Unread post by abikic »

yes, it is :)
User avatar
josh
Posts: 304
Joined: Thu Mar 11, 2021 1:05 pm
Answers: 16
x 22
x 514

Re: API help needed

Unread post by josh »

SW electrical is really a different program that doesn't have much to do with SW... I know a number of sources for SW API support, but not for SW Electrical. There is a subforum on here for SWE but it doesn't look super busy. Sorry!
abikic
Posts: 5
Joined: Fri Dec 06, 2024 1:56 am
Answers: 0

Re: API help needed

Unread post by abikic »

Hi, it is an electrical drawing but the PMAs I'm talking about, they are all notes on a drawing, so it is just an annotation. I can't find any similar API that will scan through notes on a drawing and do the things I described. :)
abikic
Posts: 5
Joined: Fri Dec 06, 2024 1:56 am
Answers: 0

Re: API help needed

Unread post by abikic »

I think I misunderstood, it is an electrical drawing, but a normal Solidworks is used.
User avatar
gupta9665
Posts: 420
Joined: Thu Mar 11, 2021 10:20 am
Answers: 25
Location: India
x 438
x 459

Re: API help needed

Unread post by gupta9665 »

SWE runs inside SW only when you do the drawings. Share some files and pictures to explain what you are trying to accomplish.
Deepak Gupta
SOLIDWORKS Consultant/Blogger
abikic
Posts: 5
Joined: Fri Dec 06, 2024 1:56 am
Answers: 0

Re: API help needed

Unread post by abikic »

This would be an example. The three notes consisting of PMA is what I already have on a drawing. What I'm trying to do is to accomplish this table (the first column in this example are PMA17 and PMA12 since they are the only notes with prefix "PMA" on a drawing) and the second column is a number after - and if the number is same after PMA then the numbers after - should sum. Since there is PMA17-100 and PMA17-200 then 100+200=300.

And this is an example so the number of rows is unknown since there are always different PMAs on different drawings. But notes consisting of PMA is always in a form of PMAxx-xxx (x is a number). I don't know if this is possible to accomplish :/
Attachments
Snimka zaslona 2024-12-11 103017.png
User avatar
josh
Posts: 304
Joined: Thu Mar 11, 2021 1:05 pm
Answers: 16
x 22
x 514

Re: API help needed

Unread post by josh »

One function of the macro I posted at https://www.cadforum.net/viewtopic.php?t=2672 is getting all notes on all sheets of a drawing. Some of that might be helpful to you.
Post Reply