Mirco Bianchini
New member
Hi all,
I was testing the new method with EKL to “copy” some wire-frame geometries from a geoset inside a product to a geoset inside another product.
The new method runs because adds the wire-frame objects inside the geoset (lines, curves, plans) but they are empty the geometries are not set.
I know that for geometry to be created, it needs a context and to set a context I can use SetWorkingContext()
I tried to set the context but didn't solve the problem, the geometries still not be set.
Do you have any clue why this thing happen?
Below the EKL script and some screenshots
inputfromRhino is a VPMReference
Output is a ProductOccurance
let items, names, unique (List)
let name, partName, geoName, localDate, geoOutputName (String)
let geoInput, geoOutput, partGeo (OpenBodyFeature)
let output3ds (PartFeature)
let reference (VPMReference)
let i (Integer)
i = 1
reference = Output.Reference
localDate = DateFormat("%y%m%d")
geoOutputName = TextFormat("#-InputOrdered", localDate)
geoInput = InputFromRhino.Query("OpenBodyFeature", "").GetItem(1)
output3ds = reference.Query("PartFeature", "").GetItem(1)
geoOutput = new("OpenBodyFeature", geoOutputName, output3ds)
items = geoInput.Query("Wireframe", "")
for i while i<= items.Size()
{
let item (Wireframe)
let nameSplit (List)
item = items.GetItem(i)
name = item.Name
nameSplit = SplitString(name, "_")
partName = nameSplit.GetItem(1)
names.Append(partName)
}
names.RemoveDuplicates()
let nameSort (List)
nameSort = names.Sort("<", "String", "String", "")
let itemCopy (Wireframe)
let conditionStr (string)
//for geoName inside nameSort
i = 1
for i while i<= 1 //nameSort.Size()
{
let namePart (string)
namePart = nameSort.GetItem(i)
//Notify("", namePart)
partGeo = new("OpenBodyFeature", namePart, geoOutput)
SetWorkingContext(partGeo)
let result (List)
conditionStr = "x.Name.Search( ""+ namePart+ "", 0, True)<>-1"
result = geoInput.Query("Wireframe", conditionStr)
//Notify("", result.Size())
let inputPart (Wireframe)
for inputPart inside result
{
let longName, wireName, wireType (String)
let listName (List)
longName = inputPart.Name
listName = SplitString(longName, "_")
wireName = listName.GetItem(2)
if inputPart.IsASortOf("Line")
itemCopy = new("Line", wireName, partGeo)
set itemCopy = inputPart
if inputPart.IsASortOf("Circle")
itemCopy = new("Circle", wireName, partGeo)
set itemCopy = inputPart
if inputPart.IsASortOf("Curve")
itemCopy = new("Curve", wireName, partGeo)
set itemCopy = inputPart
if inputPart.IsASortOf("Surface")
itemCopy = new("Surface",wireName, partGeo)
set itemCopy = inputPart
}
geoOutput.Update()
}
I was testing the new method with EKL to “copy” some wire-frame geometries from a geoset inside a product to a geoset inside another product.
The new method runs because adds the wire-frame objects inside the geoset (lines, curves, plans) but they are empty the geometries are not set.
I know that for geometry to be created, it needs a context and to set a context I can use SetWorkingContext()
I tried to set the context but didn't solve the problem, the geometries still not be set.
Do you have any clue why this thing happen?
Below the EKL script and some screenshots
inputfromRhino is a VPMReference
Output is a ProductOccurance
let items, names, unique (List)
let name, partName, geoName, localDate, geoOutputName (String)
let geoInput, geoOutput, partGeo (OpenBodyFeature)
let output3ds (PartFeature)
let reference (VPMReference)
let i (Integer)
i = 1
reference = Output.Reference
localDate = DateFormat("%y%m%d")
geoOutputName = TextFormat("#-InputOrdered", localDate)
geoInput = InputFromRhino.Query("OpenBodyFeature", "").GetItem(1)
output3ds = reference.Query("PartFeature", "").GetItem(1)
geoOutput = new("OpenBodyFeature", geoOutputName, output3ds)
items = geoInput.Query("Wireframe", "")
for i while i<= items.Size()
{
let item (Wireframe)
let nameSplit (List)
item = items.GetItem(i)
name = item.Name
nameSplit = SplitString(name, "_")
partName = nameSplit.GetItem(1)
names.Append(partName)
}
names.RemoveDuplicates()
let nameSort (List)
nameSort = names.Sort("<", "String", "String", "")
let itemCopy (Wireframe)
let conditionStr (string)
//for geoName inside nameSort
i = 1
for i while i<= 1 //nameSort.Size()
{
let namePart (string)
namePart = nameSort.GetItem(i)
//Notify("", namePart)
partGeo = new("OpenBodyFeature", namePart, geoOutput)
SetWorkingContext(partGeo)
let result (List)
conditionStr = "x.Name.Search( ""+ namePart+ "", 0, True)<>-1"
result = geoInput.Query("Wireframe", conditionStr)
//Notify("", result.Size())
let inputPart (Wireframe)
for inputPart inside result
{
let longName, wireName, wireType (String)
let listName (List)
longName = inputPart.Name
listName = SplitString(longName, "_")
wireName = listName.GetItem(2)
if inputPart.IsASortOf("Line")
itemCopy = new("Line", wireName, partGeo)
set itemCopy = inputPart
if inputPart.IsASortOf("Circle")
itemCopy = new("Circle", wireName, partGeo)
set itemCopy = inputPart
if inputPart.IsASortOf("Curve")
itemCopy = new("Curve", wireName, partGeo)
set itemCopy = inputPart
if inputPart.IsASortOf("Surface")
itemCopy = new("Surface",wireName, partGeo)
set itemCopy = inputPart
}
geoOutput.Update()
}