×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Mating parts from the origin for a submarine displacement macro

Mating parts from the origin for a submarine displacement macro

Mating parts from the origin for a submarine displacement macro

(OP)
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:open 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

http://files.engineering.com/getfile.aspx?folder=6f4d51be-a4ed-48a6-825b-e38b1b9b8363&file=Water_Volume_extraction.swp

http://files.engineering.com/getfile.aspx?folder=053c61cf-6fec-416c-b100-40103fa17479&file=Sub.SLDASM
 

RE: Mating parts from the origin for a submarine displacement macro

The Sub.sldasm assy cannot be opened without its component parts.

RE: Mating parts from the origin for a submarine displacement macro

Oh, OK. Please ignore my last post. I see you have used VCs.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources