sheetmetal global constants

Valued Contributor
Valued Contributor

How do you access these values below in Visual basic 6, I would need a step by step example, I am not a programmer, just a hacker any help would be greatly appreciated.

thanks

Paul Martz

National steel car

 

SheetMetalGlobalConstants Constant Set

 

 

Constant Value

 

seSheetMetalGlobalAccuracyForDensity 2

 

seSheetMetalGlobalBendEquationProgramId 10

 

seSheetMetalGlobalBendEquationType 9

 

seSheetMetalGlobalBendRadius 5

 

seSheetMetalGlobalDensity 1

 

seSheetMetalGlobalFlatPatternDeviationalTolerance 18

 

seSheetMetalGlobalFlatPatternInsideCornerTreatmentType 12

 

seSheetMetalGlobalFlatPatternInsideCornerTreatmentValue 16

 

seSheetMetalGlobalFlatPatternMinimumArcLength 17

 

seSheetMetalGlobalFlatPatternOutsideCornerTreatmentType 11

 

seSheetMetalGlobalFlatPatternOutsideCornerTreatmentValue 15

 

seSheetMetalGlobalFlatPatternRemoveSystemGeneratedBendRelief 14

 

seSheetMetalGlobalFlatPatternSimplifyBSplines 13

 

seSheetMetalGlobalMaterial 3

 

seSheetMetalGlobalMaterialThickness 4

 

seSheetMetalGlobalNeutralFactor 8

 

seSheetMetalGlobalReliefLength 7

 

seSheetMetalGlobalReliefWidth 6

 

 

 

Posted by: Paul Martz
Post date: 10/12/2005 3:12:31 AM

14 REPLIES

RE: sheetmetal global constants

Valued Contributor
Valued Contributor

Paul,

 

Good to hear from you!

 

Try this and let me know how it goes.

 

* Code written in VB.NET but should be close to VB6.

 

 

Dim objApp As SolidEdgeFramework.Application

Dim objDocument As SolidEdgePart.SheetMetalDocument

Dim data As Object

 

objApp = GetObject(, "SolidEdge.Application")

objDocument = objApp.ActiveDocument

objDocument.GetGlobalParameter(SolidEdgePart.SheetMetalGlobalConstants.seSheetMetalGlobalDensity, data)

 

 

Posted by: Jason Newell
Post date: 10/12/2005 3:25:24 AM

RE: sheetmetal global constants

Valued Contributor
Valued Contributor

thanks jason for the quick response,

in vb6 it asks for an "=" with an error

 

Dim objApp As SolidEdgeFramework.Application

Dim objDocument As SolidEdgePart.SheetMetalDocument

Dim data As Object

objApp = GetObject(, "SolidEdge.Application")

objDocument = objApp.ActiveDocument

objDocument.GetGlobalParameter(SolidEdgePart.SheetMetalGlobalConstants.seSheetMetalGlobalFlatPatternSimplifyBSplines,data)

 

what we are trying to do is if you are in sheetmetal, goto tools-options-flat pattern treatments

simplify b-splines option.

we are basically trying to access this option thru VB

thanks

Paul

 

Posted by: Paul Martz
Post date: 10/12/2005 4:31:09 AM

RE: sheetmetal global constants

Valued Contributor
Valued Contributor

Paul,

 

The following code below allows you to Get\Set that option. The only difference that I can think of between this code and VB6 is the Set statement, which I added for this example. The code should be very close to what you want in VB6. I do not have VB6 or I'd test it for you.

 

Let me know how it goes.

 

 

Dim objApp As SolidEdgeFramework.Application

Dim objDocument As SolidEdgePart.SheetMetalDocument

Dim bSimplifiedBSplines As Object

 

Set objApp = GetObject(, "SolidEdge.Application")

Set objDocument = objApp.ActiveDocument

 

' Check the current state of Simplify b-Splines option.

objDocument.GetGlobalParameter(SolidEdgePart.SheetMetalGlobalConstants.seSheetMetalGlobalFlatPatternSimplifyBSplines, bSimplifiedBSplines)

 

' Change the current state of Simplify b-Splines option.

objDocument.SetGlobalParameter(SolidEdgePart.SheetMetalGlobalConstants.seSheetMetalGlobalFlatPatternSimplifyBSplines, False)

 

' Check the current state of Simplify b-Splines option.

objDocument.GetGlobalParameter(SolidEdgePart.SheetMetalGlobalConstants.seSheetMetalGlobalFlatPatternSimplifyBSplines, bSimplifiedBSplines)

 

 

Posted by: Jason Newell
Post date: 10/12/2005 4:39:13 AM

RE: sheetmetal global constants

Valued Contributor
Valued Contributor

thanks again,

works fine in .net, I have someone using vb6 here and I get errors, not sure what is happening

here

Paul

 

Posted by: Paul Martz
Post date: 10/12/2005 5:01:42 AM

RE: sheetmetal global constants

Valued Contributor
Valued Contributor

thanks again, here is VB6 code to do the same thing

 

Dim objApp As SolidEdgeFramework.Application

Dim objDocument As SolidEdgePart.SheetMetalDocument

Dim bSimplifiedBSplines As Object

Set objApp = GetObject(, "SolidEdge.Application")

Set objDocument = objApp.ActiveDocument

' Change the current state of Simplify b-Splines option.

objDocument.SetGlobalParameter seSheetMetalGlobalFlatPatternSimplifyBSplines, True

End

End Sub

 

Posted by: Paul Martz
Post date: 10/12/2005 5:14:40 AM

RE: sheetmetal global constants

Valued Contributor
Valued Contributor

On a related note on the topic of sheet metal... Is there an easy way I can get the area of a sheet metal part returned to me? Also is it possible to get a blank size returned or will I have to calculate this in the variables?

 

Posted by: John Slipec
Post date: 10/14/2005 9:59:40 AM

RE: sheetmetal global constants

Valued Contributor
Valued Contributor

Dim objApp As SolidEdgeFramework.Application

Dim objDoc As SolidEdgePart.SheetMetalDocument

Dim objModel As SolidEdgePart.Model

Const TOLERANCE = 0.0001

Dim dblDensity As Double

Dim dblAccuracyIn As Double

Dim dblAccuracyOut As Double

Dim dblVolume As Double

Dim dblArea As Double

Dim dblMass As Double

Dim dblCofGravity() As Double

Dim dblCofVolume() As Double

Dim dblGlobalMoments() As Double

Dim dblPrincipalMoments() As Double

Dim dblPrincipalAxes() As Double

Dim dblRadiiOfGyration() As Double

Dim lngStatus As Long

Dim dblStartRadiusArray(1 To 4) As Double, dblEndRadiusArray(1 To 4) As Double

Dim i As Integer

Dim dbstringx As String

Dim dbstringy As String

Dim dbstringz As String

 

' Report errors

Const PI = 3.14159265358979

' Create/get the application with specific settings

On Error Resume Next

Set objApp = GetObject(, "SolidEdge.Application")

If Err Then

Err.Clear

Set objApp = CreateObject("SolidEdge.Application")

Set objDoc = objApp.Documents.Add("SolidEdge.PartDocument")

objApp.Visible = True

Else

Set objDoc = objApp.ActiveDocument

End If

Set objDoc = objApp.ActiveDocument

' Get the model object in the test case

Set objModel = objDoc.Models(1)

dblDensity = 1

dblAccuracyIn = 0.0001

Call objModel.ComputePhysicalProperties( _

Density:=dblDensity, Accuracy:=dblAccuracyIn, Volume:=dblVolume, _

Area:=dblArea, Mass:=dblMass, centerofgravity:=dblCofGravity, _

CenterOfVolume:=dblCofVolume, _

GlobalMomentsOfInteria:=dblGlobalMoments, _

PrincipalMomentsOfInteria:=dblPrincipalMoments, _

PrincipalAxes:=dblPrincipalAxes, _

RadiiOfGyration:=dblRadiiOfGyration, _

RelativeAccuracyAchieved:=dblAccuracyOut, Status:=lngStatus)

' Checking the physical properties of model

If (dblVolume - 0.001 > TOLERANCE) Or (dblArea - 0.06 > TOLERANCE) Or _

(dblMass - 0.001 > TOLERANCE) Or (dblAccuracyOut - 0.0001 > TOLERANCE) Then

MsgBox ("ComputePhysicalProperties method of Model object fails")

End If

dbstringx = Format((dblCofGravity(0) * 39.37), "#.000")

dbstringy = Format((dblCofGravity(1) * 39.37), "#.000")

dbstringz = Format((dblCofGravity(2) * 39.37), "#.000")

' Get the physical properties on the model.

Call objModel.GetPhysicalProperties( _

Status:=lngStatus, Density:=dblDensity, _

Accuracy:=dblAccuracyIn, Volume:=dblVolume, _

Area:=dblArea, Mass:=dblMass, centerofgravity:=dblCofGravity, _

CenterOfVolume:=dblCofVolume, _

GlobalMomentsOfInteria:=dblGlobalMoments, _

PrincipalMomentsOfInteria:=dblPrincipalMoments, _

PrincipalAxes:=dblPrincipalAxes, _

RadiiOfGyration:=dblRadiiOfGyration, _

RelativeAccuracyAchieved:=dblAccuracyOut)

' Checking the physical properties of model

' lngstatus value should be one. This indicates properties of the model is up to date.

If Abs(dblVolume - 0.001) > TOLERANCE Or Abs(dblArea - 0.06) > TOLERANCE Or _

Abs(dblMass - 0.001) > TOLERANCE Or Abs(dblAccuracyOut - 0.0001) > TOLERANCE Or _

(lngStatus 1) Then

MsgBox ("GetPhysicalProperties method of Model object fails")

End If

objModel.ExtrudedProtrusions(1).Depth = 0.15

'Get the physical properties on the updated model. _

Since the updated model has been not computed so _

GetPhysicalProperties returns the physical properties of the model

Call objModel.GetPhysicalProperties( _

Status:=lngStatus, Density:=dblDensity, _

Accuracy:=dblAccuracyIn, Volume:=dblVolume, _

Area:=dblArea, Mass:=dblMass, centerofgravity:=dblCofGravity, _

CenterOfVolume:=dblCofVolume, _

GlobalMomentsOfInteria:=dblGlobalMoments, _

PrincipalMomentsOfInteria:=dblPrincipalMoments, _

PrincipalAxes:=dblPrincipalAxes, _

RadiiOfGyration:=dblRadiiOfGyration, _

RelativeAccuracyAchieved:=dblAccuracyOut)

' lngstatus value should be zero. This indicates properties of the model to be out of date,

If (lngStatus 0) Then

MsgBox ("GetPhysicalProperties method of Model object fails for out-of-date values")

End If

' Checking the physical properties of model

If Abs(dblVolume - 0.001) > TOLERANCE Or Abs(dblArea - 0.06) > TOLERANCE Or _

Abs(dblMass - 0.001) > TOLERANCE Or Abs(dblAccuracyOut - 0.0001) > TOLERANCE Then

MsgBox ("GetPhysicalProperties method of Model object fails")

End If

 

' USER DISPLAY

' Release objects

Set objApp = Nothing

Set objDoc = Nothing

Set objModel = Nothing

you can use this to get the surface area of your sheetmetal part

 

remember convert to your desired units, values are in metric

let me know if it works for you

Paul

 

 

 

Posted by: Paul Martz
Post date: 10/17/2005 12:06:07 AM

RE: sheetmetal global constants

Valued Contributor
Valued Contributor

Paul,

 

Thanks for your help, it looks pretty straight forward although I did have one problem with the code. When I try to set objModel:

 

objModel = objDoc.Models(1)

I get a build error:

Interface 'SolidEdgePart.Models' cannot be indexed because it has no default property.

 

I tried removing the (1) and typed:

objModel = objDoc.Models

But then I get an exception thrown at run time: "The specified cast not valid" which points to the line I replaced

 

 

Posted by: John Slipec
Post date: 10/17/2005 2:30:34 AM

RE: sheetmetal global constants

Valued Contributor
Valued Contributor

I should also point out that I use .NET

 

Posted by: John Slipec
Post date: 10/17/2005 4:50:23 AM