Look for this sample program, it installs with SW and should be on your computer. You should find it very useful for your application.
C:\Program Files\SolidWorks\samples\visualbasic\bom
Bill Briggs, CSWP
bbriggs@cybllings.com
rocheey,
Bill,
>I need to create a view normal to a plane. Is there a way to do this
through the
>API?
you will have to first select the plane and then call:
rocheey, you may be able to select the sktch and do this also
ModelDoc2::ShowNamedView2("*Normal To")...
netshop21
The SolidWorks API can return the mass properties for a part or assembly.
retval = ModelDoc2.GetMassProperties2 ( &status )
or
retval = SldWorks.GetMassProperties ( filePathName, configurationName )
Returns this variant
[ CenterOfMassX, CenterOfMassY, CenterOfMassZ, Volume, Area...
I have created a simple part demonstrating how to do this. You will need to use the offset from surface end condition and start on the tangent point of the surface and extrude away from the surface.
Email me and I will send you this sample file.
Bill Briggs, CSWP
bbriggs@cybllings.com
Possibly you could use the show named view. This would of course require adding the named view ahead of time perhaps a macro could be used to assist this also. Use the same naming convention for the plane and named view to build the association.
example code
Part.ShowNamedView2...
This may help, email me or post a more specific question if needed. Don't know about the preview thing yet.
Dim swApp As Object
Dim swAssy As Object
Dim swPart As Object
Sub main()
Set swApp = CreateObject("SldWorks.Application")
Set swAssy = swApp.ActiveDoc
swApp.LoadFile2...