Last active
October 25, 2017 14:38
-
-
Save sheetd/99a7368310f11d1602846c784da48c16 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Action to instantiate Document Templates and set attributes | |
//let rootProduct (VPMReference) //Defined in Action dialog | |
//let gs (OpenBodyFeature) //Defined in Action dialog | |
let curGS (OpenBodyFeature) | |
let listCurveLong , listCurveShort , listAxs (List) | |
let mySurf (Surface) | |
let DT (Feature) | |
let i , j , k (Integer) | |
let axsName (String) | |
let DTinstance (VPMInstance) | |
let DTaxis , rootAxis (AxisSystem) | |
let path1, path2 (String) | |
// Inputs | |
curGS = gs.Find("OpenBodyFeature", "x.Name == \"CurvesLong\"", true) | |
listCurveLong = curGS.Query("Curve", "x.Activity == true") | |
curGS = gs.Find("OpenBodyFeature", "x.Name == \"CurvesShort\"", true) | |
listCurveShort = curGS.Query("Curve", "x.Activity == true") | |
mySurf = gs.Find("Surface", "x.Name == \"SRF_Substrate\"", true) | |
curGS = gs.Find("OpenBodyFeature", "x.Name == \"AxisSystems\"", true) | |
listAxs = curGS.Query("AxisSystem", "x.Activity == true") | |
k = 1 | |
i = 1 | |
j = 1 | |
// Loop for row | |
for i while i <= listCurveLong.Size() -2 { | |
// Loop for column | |
for j while j <= listCurveShort.Size() -2 { | |
// Instantiate Doc Template | |
set DT = InstantiateTemplate("MGM_USO_Pan_DT", rootProduct) | |
DT.SetAttributeObject("CRV_Long1" , listCurveLong.GetItem(i) ) | |
DT.SetAttributeObject("CRV_Long2" , listCurveLong.GetItem(i + 1) ) | |
DT.SetAttributeObject("CRV_Long3" , listCurveLong.GetItem(i + 2) ) | |
DT.SetAttributeObject("CRV_Short1" , listCurveShort.GetItem(j) ) | |
DT.SetAttributeObject("CRV_Short2" , listCurveShort.GetItem(j + 1) ) | |
DT.SetAttributeObject("CRV_Short3" , listCurveShort.GetItem(j + 2) ) | |
DT.SetAttributeObject("SRF_Substrate" , mySurf) | |
EndModifyTemplate(DT) | |
// Assembly Constraints | |
set DTinstance = DT | |
rootAxis = listAxs.GetItem(k) | |
path1 = rootProduct.CreatePathString(NULL , rootAxis) | |
DTaxis = DTinstance.Reference.Find("AxisSystem" , "x.Name==\"AXS_Pan\"", true) | |
path2 = rootProduct .CreatePathString(DTinstance , DTaxis) | |
rootProduct.CreateConstraint("" , "Coincidence" , path2 , path1) | |
// Attributes | |
axsName = listAxs.GetItem(k).Name() //Get name of input axis system | |
axsName = ReplaceSubText(axsName , "AXS_" , "") | |
Notify("--> Instantiating: " , axsName) | |
//DTinstance.Reference.SetAttributeString("V_Name" , axsName) //Part Title | |
DT.SetAttributeString("ID" , axsName) //Set param in template | |
j = j + 2 | |
k = k + 1 | |
} | |
i = i + 2 | |
j = 1 | |
} | |
} | |
rootProduct.Update() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment