Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

Programming: Get Coordinates in Model View

Status
Not open for further replies.

SldWorks

Computer
Joined
Jul 21, 2003
Messages
1
Location
US
Does anyone know how to determine the coordinates in model view when the Solidworks window is active even if nothing is selected? I am trying to relate mouse coordinates to the 3 dimensional coordinates of the model view window in solidworks. Thanks for the help.
 
I was trying to do the same thing a while back (I was unsuccessful). PLEASE let me know if you make any progress.

Someone said I would need to make use of a subclassing method to do this, but that is a very advanced and not-so-simple method of VB programming.

I was working on a macro that would insert a component into an assembly by just typing in the part number (no need to browse to the component). Problem was, I could not convert the mouse position coordinates to model space coordinates when the user clicks the mouse in open space (like the regular 'insert component from file' works).

I ended up requireing the user to click on the model to get a 3D point in model space for my macro as a location to insert the component. If nothing is selected, the component is inserted at 0,0,0.

Again, PLEASE let me know if you make any progress.

Thanks.
 
I'm not surprized you had trouble, Arlin. Even if you did manage to get the mouse coordinates (there is a command in the OpenGL api, I think), it would probably be in the terms of the number of pixels from the the top lefthand corner. You would then need to find out the exact position of the model window in pixels so you can tell if the mouse is inside the model window. Then you would have to map the mouse coordinates into the model coordinate system. I have no idea how SolidWorks even does this, but I think it would be really quite difficult.

I'm knackered just thinking about it...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top