static void ReportItem(SolidEdgePart.Round round) { Console.WriteLine("DisplayName: {0}", round.DisplayName); Console.WriteLine("EdgebarName: {0}", round.EdgebarName); Console.WriteLine("Name: {0}", round.Name); Console.WriteLine("SystemName: {0}", round.SystemName); }
static void Main(string[] args) { SolidEdgeFramework.Application application = null; SolidEdgeFramework.Documents documents = null; SolidEdgePart.PartDocument partDocument = null; SolidEdgePart.Model model = null; SolidEdgePart.RevolvedProtrusions revolvedProtrusions = null; SolidEdgePart.RevolvedProtrusion revolvedProtrusion = null; SolidEdgeGeometry.Edges edges = null; SolidEdgePart.Rounds rounds = null; SolidEdgePart.Round round = null; SolidEdgeFramework.SelectSet selectSet = null; try { // Register with OLE to handle concurrency issues on the current thread. SolidEdgeCommunity.OleMessageFilter.Register(); // Connect to or start Solid Edge. application = SolidEdgeCommunity.SolidEdgeUtils.Connect(true, true); // Get a reference to the Documents collection. documents = application.Documents; // Create a new PartDocument. partDocument = documents.AddPartDocument(); // Always a good idea to give SE a chance to breathe. application.DoIdle(); // Call helper method to create the actual geometry. model = PartHelper.CreateFiniteRevolvedProtrusion(partDocument); // Get a reference to the RevolvedProtrusions collection. revolvedProtrusions = model.RevolvedProtrusions; // Get a reference to the new RevolvedProtrusion. revolvedProtrusion = revolvedProtrusions.Item(1); // Get a all Edges. edges = (SolidEdgeGeometry.Edges)revolvedProtrusion.Edges[SolidEdgeGeometry.FeatureTopologyQueryTypeConstants.igQueryAll]; List <SolidEdgeGeometry.Edge> edgeList = new List <SolidEdgeGeometry.Edge>(); List <double> radiusList = new List <double>(); // Build arrays. foreach (SolidEdgeGeometry.Edge edge in edges) { edgeList.Add(edge); radiusList.Add(0.002); } // Get a reference to the Rounds collection. rounds = model.Rounds; // Add single round with multiple Edges. round = rounds.Add(edgeList.Count, edgeList.ToArray(), radiusList.ToArray()); // Get a reference to the ActiveSelectSet. selectSet = application.ActiveSelectSet; // Empty ActiveSelectSet. selectSet.RemoveAll(); // Add new Round to ActiveSelectSet. selectSet.Add(round); // Switch to ISO view. application.StartCommand(SolidEdgeConstants.PartCommandConstants.PartViewISOView); } catch (System.Exception ex) { Console.WriteLine(ex.Message); } finally { SolidEdgeCommunity.OleMessageFilter.Unregister(); } }
static void Main(string[] args) { SolidEdgeFramework.Application application = null; SolidEdgePart.SheetMetalDocument sheetMetalDocument = null; SolidEdgePart.FamilyMembers familyMembers = null; SolidEdgePart.Round round = null; SolidEdgePart.UserDefinedPattern userDefinedPattern = null; SolidEdgeFrameworkSupport.Dimension dimension = null; try { // Register with OLE to handle concurrency issues on the current thread. SolidEdgeCommunity.OleMessageFilter.Register(); // Connect to or start Solid Edge. application = SolidEdgeCommunity.SolidEdgeUtils.Connect(true, true); // Bring Solid Edge to the foreground. application.Activate(); // Get a reference to the active part document. sheetMetalDocument = application.GetActiveDocument <SolidEdgePart.SheetMetalDocument>(false); if (sheetMetalDocument != null) { // Get a reference to the FamilyMembers collection. familyMembers = sheetMetalDocument.FamilyMembers; // Interate through the family members. foreach (var familyMember in familyMembers.OfType <SolidEdgePart.FamilyMember>()) { Console.WriteLine(familyMember.Name); // Determine FamilyMember MovePrecedence. switch (familyMember.MovePrecedence) { case SolidEdgePart.MovePrecedenceConstants.igModelMovePredecence: break; case SolidEdgePart.MovePrecedenceConstants.igSelectSetMovePrecedence: break; } // Warning: Accessing certain LiveRule[...] properties may throw an exception. //Console.WriteLine("igConcentricLiveRule - {0}", familyMember.LiveRule[SolidEdgePart.LiveRulesConstants.igConcentricLiveRule]); //Console.WriteLine("igCoplanarAxesAboutXLiveRule - {0}", familyMember.LiveRule[SolidEdgePart.LiveRulesConstants.igCoplanarAxesAboutXLiveRule]); //Console.WriteLine("igCoplanarAxesAboutYLiveRule - {0}", familyMember.LiveRule[SolidEdgePart.LiveRulesConstants.igCoplanarAxesAboutYLiveRule]); //Console.WriteLine("igCoplanarAxesAboutZLiveRule - {0}", familyMember.LiveRule[SolidEdgePart.LiveRulesConstants.igCoplanarAxesAboutZLiveRule]); //Console.WriteLine("igCoplanarAxesLiveRule - {0}", familyMember.LiveRule[SolidEdgePart.LiveRulesConstants.igCoplanarAxesLiveRule]); //Console.WriteLine("igCoplanarLiveRule - {0}", familyMember.LiveRule[SolidEdgePart.LiveRulesConstants.igCoplanarLiveRule]); //Console.WriteLine("igMaintainRadiusLiveRule - {0}", familyMember.LiveRule[SolidEdgePart.LiveRulesConstants.igMaintainRadiusLiveRule]); //Console.WriteLine("igOrthoLockingLiveRule - {0}", familyMember.LiveRule[SolidEdgePart.LiveRulesConstants.igOrthoLockingLiveRule]); //Console.WriteLine("igParallelLiveRule - {0}", familyMember.LiveRule[SolidEdgePart.LiveRulesConstants.igParallelLiveRule]); //Console.WriteLine("igPerpendicularLiveRule - {0}", familyMember.LiveRule[SolidEdgePart.LiveRulesConstants.igPerpendicularLiveRule]); //Console.WriteLine("igSymmetricLiveRule - {0}", familyMember.LiveRule[SolidEdgePart.LiveRulesConstants.igSymmetricLiveRule]); //Console.WriteLine("igSymmetricXYLiveRule - {0}", familyMember.LiveRule[SolidEdgePart.LiveRulesConstants.igSymmetricXYLiveRule]); //Console.WriteLine("igSymmetricYZLiveRule - {0}", familyMember.LiveRule[SolidEdgePart.LiveRulesConstants.igSymmetricYZLiveRule]); //Console.WriteLine("igSymmetricZXLiveRule - {0}", familyMember.LiveRule[SolidEdgePart.LiveRulesConstants.igSymmetricZXLiveRule]); //Console.WriteLine("igTangentEdgeLiveRule - {0}", familyMember.LiveRule[SolidEdgePart.LiveRulesConstants.igTangentEdgeLiveRule]); //Console.WriteLine("igTangentTouchingLiveRule - {0}", familyMember.LiveRule[SolidEdgePart.LiveRulesConstants.igTangentTouchingLiveRule]); //Console.WriteLine("igThicknessChainLiveRule - {0}", familyMember.LiveRule[SolidEdgePart.LiveRulesConstants.igThicknessChainLiveRule]); // Interate through the suppressed features of the current family member. for (int j = 1; j <= familyMember.SuppressedFeatureCount; j++) { object suppressedFeature = familyMember.SuppressedFeature[j]; // Use helper class to get the feature type. var featureType = SolidEdgeCommunity.Runtime.InteropServices.ComObject.GetPropertyValue <SolidEdgePart.FeatureTypeConstants>(suppressedFeature, "Type", (SolidEdgePart.FeatureTypeConstants) 0); switch (featureType) { case SolidEdgePart.FeatureTypeConstants.igRoundFeatureObject: round = (SolidEdgePart.Round)suppressedFeature; break; case SolidEdgePart.FeatureTypeConstants.igUserDefinedPatternFeatureObject: userDefinedPattern = (SolidEdgePart.UserDefinedPattern)suppressedFeature; break; } } // Interate through the variables of the current family member. for (int j = 1; j <= familyMember.VariableCount; j++) { object variable = familyMember.Variable[j]; // Use helper class to get the object type. var objectType = SolidEdgeCommunity.Runtime.InteropServices.ComObject.GetPropertyValue <SolidEdgeFramework.ObjectType>(variable, "Type", (SolidEdgeFramework.ObjectType) 0); switch (objectType) { case SolidEdgeFramework.ObjectType.igDimension: dimension = (SolidEdgeFrameworkSupport.Dimension)variable; break; } } } } else { throw new System.Exception("No active document."); } } catch (System.Exception ex) { Console.WriteLine(ex.Message); } finally { SolidEdgeCommunity.OleMessageFilter.Unregister(); } }
static void Main(string[] args) { SolidEdgeFramework.Application application = null; SolidEdgeFramework.Documents documents = null; SolidEdgePart.PartDocument partDocument = null; SolidEdgePart.RefPlanes refPlanes = null; SolidEdgePart.RefPlane refPlane = null; SolidEdgeFramework.SelectSet selectSet = null; Array features = Array.CreateInstance(typeof(object), 0); SolidEdgePart.ExtrudedProtrusion extrudedProtrustion = null; SolidEdgePart.Round round = null; try { // Register with OLE to handle concurrency issues on the current thread. SolidEdgeCommunity.OleMessageFilter.Register(); // Connect to or start Solid Edge. application = SolidEdgeCommunity.SolidEdgeUtils.Connect(true, true); // Get a reference to the documents collection. documents = application.Documents; // Create a new part document. partDocument = documents.AddPartDocument(); // Always a good idea to give SE a chance to breathe. application.DoIdle(); // Get a reference to the RefPlanes collection. refPlanes = partDocument.RefPlanes; // Get a reference to the top RefPlane using extension method. refPlane = refPlanes.GetTopPlane(); // Get path to Solid Edge training directory. Typically, 'C:\Program Files\Solid Edge XXX\Training'. var trainingDirectory = new System.IO.DirectoryInfo(SolidEdgeCommunity.SolidEdgeUtils.GetTrainingFolderPath()); // Build path to source part document. var LibName = System.IO.Path.Combine(trainingDirectory.FullName, "block.par"); // This method will take all features from block.par and place them into the new part document. partDocument.PlaceFeatureLibrary(LibName, refPlane, 0.0, 0.0, 0.0, out features); // Optionally, iterate through all of the added features. foreach (object feature in features) { // Use helper class to get the feature type. var featureType = SolidEdgeCommunity.Runtime.InteropServices.ComObject.GetPropertyValue <SolidEdgePart.FeatureTypeConstants>(feature, "Type", (SolidEdgePart.FeatureTypeConstants) 0); // Depending on the feature type, we can cast the weakly typed feature to a strongly typed feature. switch (featureType) { case SolidEdgePart.FeatureTypeConstants.igExtrudedProtrusionFeatureObject: extrudedProtrustion = (SolidEdgePart.ExtrudedProtrusion)feature; break; case SolidEdgePart.FeatureTypeConstants.igRoundFeatureObject: round = (SolidEdgePart.Round)feature; break; } } // Get a reference to the ActiveSelectSet. selectSet = application.ActiveSelectSet; // Empty ActiveSelectSet. selectSet.RemoveAll(); // Add all features to ActiveSelectSet. foreach (object feature in features) { selectSet.Add(feature); } // Switch to ISO view. application.StartCommand(SolidEdgeConstants.PartCommandConstants.PartViewISOView); } catch (System.Exception ex) { Console.WriteLine(ex.Message); } finally { SolidEdgeCommunity.OleMessageFilter.Unregister(); } }