Jump to content

Macro Help SW09


Recommended Posts

Posted

Im just trying to learn the macro function in SW and im having some issues. Here is what I am doing.

 

First I open a new file, create a square 100mm x 100mm, extrude this 25mm and save the file. I then click record, Sketch, select a face on my solid, create some sort of geometry. Exit sketch. Extrude cut. Stop recording and save my macro.

 

I have tried to create and array off holes, a single hole, and convert entities and create offset geometry of my square.

 

What happens,

 

When I run the macro, the single hole in the middle of my solid is drawn, but it does not get extruded through the part.

 

When I run the macro with the hole array, it prompts me for dimmensions and then i get a run time error 91.

 

When I run the macro with the offset it will create the offset sketch but will not extrude through my part(or at all).

 

My question is am I doing something wrong? At first I had an issue with photoworks add-in and I turned that off, but not it just appears as though it will not perform solid operations and it doesnt like it when i dimmension the sketch while recording the macro.

 

I dont really need this for anything now, but I was trying to expand my knowledge of SW.

 

Thanks

 

ps, because an swp file isnt valid, i copied the offset macro into a txt file and uploaded it.

offsetMacro.txt

Posted

i was able to get part of it working. When in sketch mode i need to go to the feature tab(before exiting the sketch) and perform my extrude cut. For some reason once you exit the sketch the macro stops.

 

I still am not able to get it to work with dimmension values though. Whenever it gets to the dimmensioned portion it prompts the user for input and no matter what is entered i get a run time error.

  • 4 weeks later...
Posted

I'm a little late to this post so sorry if you've already gotten past this. My recollection of using macros in SW is that it doesn't always grab the menu stuff. Buttons though should work. Also, and sorry if I misunderstand- if you're trying to cut w/the sketch you just made, why exit the sketch? You might try it again w/o exiting the sketch and see how it works.

 

Menu items, iirc, will require API. I'd start w/a macro and edit from there. LOTS of API goodness on the web and in the SW help file. The same with prompting the user for dimensions. You can edit the macro to generate the same dims every time, but needing input from the user makes it more difficult.

Posted

thanks for the reply aza. I havent done much more with it since i was just playing around and had no real need for it at the time. As you mentioned and as i posted the only way i was able to get the cut portion of it to work was going through the feature tab before exiting the sketch. If i exited the sketch and used the selection process to pick my sketch I would get the run time error. I never did figure it out in regards to entering dimensions though. When i have the time i would like to continue to play with this.

 

Do you have any insight to that? Say I drew a square and needed to dimensions it in the macro.

 

Thanks

  • 2 weeks later...
Posted

I played with it a bit more today.

 

As long as you do everything through the tabs that open up and not actually apply dimmensions to the drawings, everything works. I was able to get an array of holes cut into a plate.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...