using BCIMNETGS = Bentley.CIMNET.CIMGeometry.Solid; using BCIMNETT = Bentley.CIMNET.CIMTemplate; using BCIFLG = Bentley.CifNET.LinearGeometry; /*---------------------------------------------------------------------------------**//** *使用单元模板加参数化变量约束的方法生成solid。 *solidTemplate1: 参数化模板1 *solidTemplate2: 参数化模板2 *startTemplateLocation: 参数化模板1放置的位置 *endTemplateLocation: 参数化模板2放置的位置 *planLinearElement: 实体生成路径的平曲线 *profileElement: 实体生成路径的纵曲线 *startLimitLine: 实体的起点限制曲线 *endLimitLine: 实体的终点限制曲线 +---------------+---------------+---------------+---------------+---------------+------*/ void Example_CreateSolidWithSolidTemplate2(BCIMNETT.Template solidTemplate1, BCIMNETT.Template solidTemplate2, double startTemplateLocation, double endTemplateLocation, BCIFLG.LinearElement planLinearElement, BCIFLG.ProfileElement profileElement, BCIFLG.LinearElement startLimitLine, BCIFLG.LinearElement endLimitLine) { // 构造 SolidCorridor, 可根据参数选择生成的实体横断面垂直于地面或垂直于路径。 BCIMNETGS.SolidCorridor corridor = new BCIMNETGS.SolidCorridor(planLinearElement, profileElement, BCIMNETGS.SectionVerticalRotation.Vertical); // 添加SolidCorridorInternal, 确定solid实体段的生成规则 corridor.AddSolidCorridorInterals("Segement_2", solidTemplate1, solidTemplate2, startTemplateLocation, endTemplateLocation, modelRef, startLimitLine, endLimitLine, 0.0, 0.0); // 生成实体并获取结果 BCIMNETGS.ISolidCreator solidFromCorridor = new BCIMNETGS.ISolidCreator(corridor, modelRef); solidFromCorridor.CreateSolid(); List<SolidKernelEntity> solidBodies = new List<SolidKernelEntity>(); solidFromCorridor.GetSolidBodies(solidBodies); foreach (SolidKernelEntity solid in solidBodies) { if (solid != null) { Bentley.DgnPlatformNET.Elements.Element ehOut; Bentley.DgnPlatformNET.Convert1.BodyToElement(out ehOut, solid, null, modelRef); ehOut.AddToModel(); } } }