Wire Bodies

Hi,

To reduce my problem to a minimum: I want to create a wire bodyfrom a simple line and store it with the part document. A usual wayto store temporary bodies is to make them into a feature withPartDocument::CreateFeatureFromBody3. This does not seem to workwith wire bodies.

And a second question concerning wire bodies: How can I display awire body? At the moment I highlight the edges.

I give a sample code (without highlighting):

Dim swApp As SldWorks.SldWorks
Dim swPart As SldWorks.PartDoc
Dim swCurve As SldWorks.Curve
Dim trimmed_curve As SldWorks.Curve
Dim swFeature As SldWorks.Feature
Dim swModeler As SldWorks.Modeler
Dim swBody As SldWorks.Body2

Dim nPt(2) As Double
Dim vPt As Variant
Dim vDir As Variant
Dim retval As Long
Set swApp = CreateObject("SldWorks.Application")
Set swPart = swApp.ActiveDoc
Set swModeler = swApp.GetModeler
nPt(0) = 0
nPt(1) = 0
nPt(2) = 0
vPt = nPt
nPt(0) = 1
nPt(1) = 1
nPt(2) = 0
vDir = nPt
Set swCurve = swModeler.CreateLine(vPt, vDir)
Set trimmed_curve = swCurve.CreateTrimmedCurve2(0, 0, 0, 1, 1, 0)
Set swBody = trimmed_curve.CreateWireBody()

retval = swBody.Display3(swPart, 255, swTempBodySelectable)
swBody.HideBody False

Set swFeature = swPart.CreateFeatureFromBody3(swBody, True,swCreateFeatureBodyCheck)


Unfortunately, swFeature is set to Nothing. Although the wire bodycan be selected at the end of this procedure, I can access it onlyas long as I hold the swBody object.

I also tried the following with my temporary body:
Dim swFeatureData as SldWorks.ImportedCurveFeatureData

Set swFeatureData = swFeatureManager.CreateDefinition(swFmImported)
swFeatureData.SetBody(swBody)
Set swFeature = swFeatureManager.CreateFeature(swFeatureData)

But CreateDefinition returns Nothing and does not seem do supportImportedFeatureData.

Any ideas are welcome.

Regards
Robert

P.S.: I do not want to use SketchLines. I want that the writtengeometry is resp. consists of a SldWorks.EntitySolidworksApi macros