AnsweredAssumed Answered

Reference Geometry: Coordinate System creation

Question asked by Austin Schukar on Nov 13, 2019
Latest reply on Nov 14, 2019 by Austin Schukar

I'm trying to create a macro that retrieves persistent reference IDs from a .txt file (created from another macro). This .txt file has stored 64-bit values for: Sketch Point ID (comma) Sketch Line ID

 

I then use these objects and (per line) create a coordinate system to align to these objects.

 

While Not oFile.AtEndOfStream

Line = oFile.ReadLine
ent = Split(Line, ",")

' Retrieve sketch point ID and set object.
skPointID = Base64ToArray(ent(0))
Set skPoint = swModel.Extension.GetObjectByPersistReference3(skPointID, err)

' Retrieve sketch line ID and set object.
skLineID = Base64ToArray(ent(1))
Set skLine = swModel.Extension.GetObjectByPersistReference3(skLineID, err)

' Create coordinate system and get definition.
Set swFeat = swFeatMgr.InsertCoordinateSystem(False, False, False)
Set cSysData = swFeat.GetDefinition

' Find CS name and send feature to end of feature tree.
ftname = swFeat.Name
bRet = swModel.Extension.ReorderFeature(ftname, ftname, swMoveToEnd)

cSysData.AccessSelections swModel, swComp
cSysData.OriginEntity = skPoint
cSysData.XAxisEntities = skLine

boolstatus = swFeat.ModifyDefinition(cSysData, swModel, Nothing)
cSysData.ReleaseSelectionAccess

Wend

 

The above code is a snippet of what I currently have running; however, it has only been able to assign cSysData.OriginEntity [line 23] to 'skPoint'. I cannot seem to get the designation of cSysData.XAxisEntities to 'skLine'. Does anyone see an issue with my order of operations here? I have made skPoint & skLine Object type variables, and am worried that I cannot assign skLine object to xAxisEntities.

 

 

Thanks in advance,

 

Austin

Outcomes