Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mating parts from the origin for a submarine displacement macro

Status
Not open for further replies.

Sub596

Marine/Ocean
Jan 2, 2011
2
Hello

Problem:
When I use this code to mate parts using the origin from both parts it give me
swAddMateError_IncorrectSelections

'mate using origin point does not work
'Set myMate = swAssy.AddMate3(20, -1, False, 0, 0, 0, 0, 0, 0, 0, 0, False, longstatus)

I can get it to mate if I use this code but the axes are not aligned
Set myMate = swAssy.AddMate3(0, -1, False, 0, 0, 0, 0, 0, 0, 0, 0, False, longstatus)

Any idea what I AM DOING WRONG
Thank you

Background:
I am writing a macro that will calculate all displaced water from a submerged submarine
What I am mainly interested in is Center of buoyancy that I will get from the center of gravity of displaced water. I will also get the total buoyancy

Status:
It is roughly working. I hacked code from many projects on the web. It still needs lots of refinement. It also needs many more features I will be implementing. Feel free to improve it. This is my first macro in solidworks.

Operation:
Open a assembly
Start the macro
Macro steps=
1:save current assembly as a part
2:eek:pen part and join all elemts
3:create a encompassing cube
4:subtract the join from the cube
5:creat a bigger cube
6:subtract the first result from the second cube
7:result is the total water volume displaced
8:change material to water
9:calculate mass and center of gravity
10:add note with mass and center of buoyancy
11:add the part to the assembly
12:mate the part with the origin

i will be adding a few more features to make it more usable
files
I uploaded a test submarine assembly
Also the current state of the macro


 
Replies continue below

Recommended for you

Status
Not open for further replies.

Part and Inventory Search

Sponsor