Author Topic: How to insert a welded outlet to a pipe in In AutoCAD Mep.net  (Read 2253 times)

0 Members and 1 Guest are viewing this topic.

Shibu

  • Guest
How to insert a welded outlet to a pipe in In AutoCAD Mep.net
« on: December 13, 2013, 12:07:05 PM »
Hi Please Help to Solve the issue. This is an urgent need that is why I am contacting you. I want to insert a new welded outlet to a pipe. When I try
It inserted at the curve of the pipe.(where the location which I give). The problem is, it’s not projecting outside of the pipe , like we inserted manually.
May have Problem with my code. Please help me to get the code to insert any outlets to a pipe .



This is MEP 2014
Api - .NET
Win – 7-64 Bit




MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: How to insert a welded outlet to a pipe in In AutoCAD Mep.net
« Reply #1 on: December 13, 2013, 01:14:16 PM »
Can you post the code you have?
Revit 2019, AMEP 2019 64bit Win 10

Shibu

  • Guest
Re: How to insert a welded outlet to a pipe in In AutoCAD Mep.net
« Reply #2 on: December 13, 2013, 01:41:20 PM »
Using PyroCADTrans As Transaction = PyroCAD_Commands.PyroCADTransMgr.StartTransaction

Dim objTakeoff As new PipeFitting
Dim PyroCADQuery As New DataQuery()
PyroCADQuery.AddSizeParameter(Context.ConnectionSizeNominalDiameter, 1,1.0)
PyroCADQuery.PartGuid = "37914362-5B45-40EB-A0C5-8E746ABE373F"
PyroCADQuery.SubType = "Threaded Outlet"
Dim partList1 As DataPartsList = PartManager.GetPartsList(PyroCADQuery)
Dim MvPartExpandableTable As DataExpandedTable = PartManager.GetPartTable(PyroCADQuery, maxRecords)
Dim recordcol As DataRecordCollection = MvPartExpandableTable.DataRecords
Dim MvpartRecord As DataRecord = recordcol(0)

PartManager.CreatePartViaRecord(MvPartExpandableTable, MvpartRecord, objTakeoff)
Dim strLayerKey As String = objTakeoff.LayerKey
Dim dicLayerKey As New AECDBService.DictionaryLayerKeyStyle(PyroCAD_Commands.PyroCADDB)

objTakeoff.Location = “A Point on a pipe”


'Finally we will add the union to the database ands commit the transaction
Dim bt As BlockTable = CType(PyroCAD_Commands.PyroCADDB.TransactionManager.GetObject(PyroCAD_Commands.PyroCADDB.BlockTableId, OpenMode.ForRead, False), BlockTable)
Dim btr As BlockTableRecord = CType(PyroCAD_Commands.PyroCADDB.TransactionManager.GetObject(bt(BlockTableRecord.ModelSpace), OpenMode.ForWrite, False), BlockTableRecord)
btr.AppendEntity(objTakeoff)

PyroCAD_Commands.PyroCADDB.TransactionManager.AddNewlyCreatedDBObject(objTakeoff, True)

PyroCADTrans.Commit()

iam getting the takeoff inserted to the insertion point which i given , the entire takeoff go inside the pipe. but it is not like when we manually inserted, when manually inserted it connection point attach to the pipe curve but insertion point will at the edge of the pipe.
« Last Edit: December 13, 2013, 01:47:27 PM by Shibu »

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: How to insert a welded outlet to a pipe in In AutoCAD Mep.net
« Reply #3 on: December 13, 2013, 01:55:54 PM »
You're missing an AnchorEntityToCurve() object to tie the o-let and pipe together.

After PyroCAD_Commands.PyroCADDB.TransactionManager.AddNewlyCreatedDBObject(objTakeoff, True) add:
Code - C#: [Select]
  1. var anchor = AnchorEntityToCurve();
  2. anchor.CurveId = pipe.ObjectId;  <--- you need to know what pipe you're attaching it to for the anchor
  3. objTakeoff.SetAnchor(anchor);

This will get it attached but you'll have to play with the anchor rotation properties to get things pointed the way you want them to.   
Revit 2019, AMEP 2019 64bit Win 10

Shibu

  • Guest
Re: How to insert a welded outlet to a pipe in In AutoCAD Mep.net
« Reply #4 on: December 13, 2013, 02:09:00 PM »
Thank you for yuor kind attention
i anchored it but still it is placed inside the curve

Dim objhost As Object = Nothing
 objhost = PyroCADTrans.GetObject(objPipeId, Autodesk.AutoCAD.DatabaseServices.OpenMode.ForRead)
                Dim objGeo As Autodesk.Aec.DatabaseServices.Geo = CType(objhost, Autodesk.Aec.DatabaseServices.Geo)
                Dim escEnt As Matrix3d = objGeo.Ecs
 Dim objAnc As New AnchorFittingToCurve
objAnc.CurveId = objPipeId
                objAnc.Rotation = AngleToRadians(90)
  objTakeoffTemp.SetAnchor(objAnc)

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: How to insert a welded outlet to a pipe in In AutoCAD Mep.net
« Reply #5 on: December 13, 2013, 03:01:26 PM »
Try setting the anchor before altering the rotation.  Just a guess.  You can also try calling objTakeoff.UpdateFromAnchor(anchor)
Revit 2019, AMEP 2019 64bit Win 10