.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Creating Socketweld connection in Plant3D

1 REPLY 1
Reply
Message 1 of 2
alexandrescoelho
391 Views, 1 Reply

Creating Socketweld connection in Plant3D

Hello,

I'm trying to create a assembly with .NET to draw all objects from a chosen spec. I started from Plant3D SDK which have a sample project. Autodesk ADN support is too slow to answer some basic questions since they have changed support platform recently. So, I hope someone can help me here. Smiley Wink
After hours searching and trying to reach the main goal, I understood how connections between objects are done. The connector is based on End Type of objects. I'm not a meterial guy, so everything is much more difficult to me Smiley Sad
At CreatePipeline (..\Plant SDK 2013\Samples\Piping\CreatePipeline) sample we have a class PipelineConnector which create connector. The main problem is only Buttweld connector code is available at CreatePart method in this class. I'm needing a piece of code where creation for others connector types such as Socketweld are shown.
Please, any help is very very appreciated.

the CreatePart code below:

 

public override void CreatePart()
        {
            Database db = AcadApp.DocumentManager.MdiActiveDocument.Database;
            ContentManager cm = ContentManager.GetContentManager();

            part.Position = InsertPoint;
            part.SlopeTolerance = 0.1;
            part.OffsetTolerance = 0.0;

            if (ConnTypeName.Equals("Gasket"))
            {
                // Gasket
                //
                //PartName = "Gasket";
                var spGPart = GetSpecPart("Gasket");
                PSPColl.Add(spGPart);

                var blockSubPart = new BlockSubPart();
                ObjectId Id = ObjectId.Null;
                try
                {
                    if (spGPart.PropValue("ContentGeometryParamDefinition") != null)
                        Id = cm.GetSymbol(spGPart, db);
                    blockSubPart.SymbolId = Id;
                }
                catch { }

                part.AddSubPart(blockSubPart);

                // BoltSet
                // 
                var spBPart = GetSpecPart("BoltSet");

                BoltSetSubPart boltsetSubPart = new BoltSetSubPart();
                boltsetSubPart.PartSizeProperties.NominalDiameter = NomDia;
                boltsetSubPart.Length = NomDia.Value * 2;
                part.AddSubPart(boltsetSubPart);                
                
                PSPColl.Add(spBPart);
            }
            else if (ConnTypeName.Equals("Buttweld"))
            {
                Project activeProject = PlantApp.CurrentProject.ProjectParts["Piping"];
                PartSizeProperties psprops = new NonSpecPart();
                psprops.Name = "Buttweld";
                psprops.NominalDiameter = NomDia;
                psprops.Type = "Buttweld";
                psprops.Spec = SpecName;

                Double dWeldGap = 0;
                String bWeldGap = String.Empty;
                activeProject.GetProjectVariable("USEWELDGAPS", out bWeldGap);
                if (String.Compare("TRUE", bWeldGap, true) == 0)
                {
                    String sWeldGap = String.Empty;
                    activeProject.GetProjectVariable("WELDGAPSIZE", out sWeldGap);
                    if (!String.IsNullOrEmpty(sWeldGap))
                    {
                        Double.TryParse(sWeldGap, out dWeldGap);
                    }
                }

                WeldSubPart weldSubPart = new WeldSubPart();
                weldSubPart.Width = dWeldGap;
                part.AddSubPart(weldSubPart);
                PSPColl.Add(psprops);
            }
            
            PartObject = part;
        }

 

1 REPLY 1
Message 2 of 2

Have you seen the equivalent 2014 SDK sample?




Fenton Webb
AutoCAD Engineering
Autodesk

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost