Hello,
I need to measure the weight and center of gravity of each section along my ship. I need to export this information to a spreadsheet.
There is the Weight and Center of Gravity feature in the basic design module, which exports the weight and CoG of a certain section in a spreadsheet. But how can I modify this feature so that my spreadsheet will show the weight and CoG of all of my sections along the ship? The cells of a row would contain the following:
Section 1 Weight(t) Xcg(m) Ycg(m) Zcg(m), and so on with Section 2 in the second row, Section 3 in the third row...
The journaling doesn't help me a lot, because I'm very new to this, and when I record the steps of this feature, it doesn't record creating the excel. (When I use this feature without recording, then it shows the excel with the information at the end, but when I use the feature while recording, it doesn't even show the excel at the end.) All it records is this:
Imports System Imports NXOpen Module NXJournal Sub Main (ByVal args()AsString) Dim theSession As NXOpen.Session= NXOpen.Session.GetSession()Dim workPart As NXOpen.Part= theSession.Parts.Work Dim displayPart As NXOpen.Part= theSession.Parts.Display ' ----------------------------------------------' Menu: Application->Ship Structure->Basic Design' ----------------------------------------------Dim markId1 As NXOpen.Session.UndoMarkId=Nothing markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Enter Ship Structure Basic Design") theSession.ApplicationSwitchImmediate("UG_APP_SHIP_BASICDESIGN") displayPart.Features.ShipCollection.RegisterCallbackFunctionsForMirrorCopy() displayPart.Features.ShipCollection.SetSteelFeatureApproach(NXOpen.Features.ShipCollection.SteelFeatureApproach.SketchSharing) theSession.CleanUpFacetedFacesAndEdges() ' ----------------------------------------------' Menu: Tools->Ship Design->Weight and Center of Gravity...' ----------------------------------------------Dim markId2 As NXOpen.Session.UndoMarkId=Nothing markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start") Dim weightAndCGBuilder1 As NXOpen.Features.ShipDesign.WeightAndCGBuilder=Nothing weightAndCGBuilder1 = workPart.Features.ShipCollection.CreateWeightAndCgBuilder() theSession.SetUndoMarkName(markId2, "Weight and Center of Gravity Dialog") Dim component1 As NXOpen.Assemblies.Component=CType(displayPart.ComponentAssembly.RootComponent.FindObject("COMPONENT 000876/A 1"), NXOpen.Assemblies.Component) Dim body1 As NXOpen.Body=CType(component1.FindObject("PROTO#.Bodies|ShipSection(70:2A)"), NXOpen.Body) weightAndCGBuilder1.VolumeBody.Value= body1 Dim markId3 As NXOpen.Session.UndoMarkId=Nothing markId3 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Weight and Center of Gravity") Dim nXObject1 As NXOpen.NXObject=Nothing nXObject1 = weightAndCGBuilder1.Commit() theSession.DeleteUndoMark(markId3, Nothing) theSession.SetUndoMarkName(markId2, "Weight and Center of Gravity") weightAndCGBuilder1.Destroy() Dim markId4 As NXOpen.Session.UndoMarkId=Nothing markId4 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start") Dim weightAndCGBuilder2 As NXOpen.Features.ShipDesign.WeightAndCGBuilder=Nothing weightAndCGBuilder2 = workPart.Features.ShipCollection.CreateWeightAndCgBuilder() theSession.SetUndoMarkName(markId4, "Weight and Center of Gravity Dialog") ' ----------------------------------------------' Dialog Begin Weight and Center of Gravity' ---------------------------------------------- weightAndCGBuilder2.Destroy() theSession.UndoToMark(markId4, Nothing) theSession.DeleteUndoMark(markId4, Nothing) theSession.CleanUpFacetedFacesAndEdges() ' ----------------------------------------------' Menu: Tools->Journal->Stop Recording' ---------------------------------------------- EndSubEndModule
When I play it back, nothing happens.
Do you have a good idea how it could be done? Thanks if you can help me.
I