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<br><br> Line = oFile.ReadLine<br> ent = Split(Line, ",")<br><br> ' Retrieve sketch point ID and set object.<br> skPointID = Base64ToArray(ent(0))<br> Set skPoint = swModel.Extension.GetObjectByPersistReference3(skPointID, err)<br><br> ' Retrieve sketch line ID and set object.<br> skLineID = Base64ToArray(ent(1))<br> Set skLine = swModel.Extension.GetObjectByPersistReference3(skLineID, err)<br><br> ' Create coordinate system and get definition.<br> Set swFeat = swFeatMgr.InsertCoordinateSystem(False, False, False)<br> Set cSysData = swFeat.GetDefinition<br><br> ' Find CS name and send feature to end of feature tree.<br> ftname = swFeat.Name<br> bRet = swModel.Extension.ReorderFeature(ftname, ftname, swMoveToEnd)<br><br> cSysData.AccessSelections swModel, swComp<br> cSysData.OriginEntity = skPoint<br> cSysData.XAxisEntities = skLine<br><br> boolstatus = swFeat.ModifyDefinition(cSysData, swModel, Nothing)<br> cSysData.ReleaseSelectionAccess<br><br> Wend<br><span class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span>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
SolidworksApi/macros