autocad plant 3d 2018 drawing exploded when converted
By Augusto Goncalves
If you plan to starting time developing for any new product, a quick 'getting started' guide tin be very useful. Here is what you need to develop for AutoCAD P&ID/Plant 3D 2013.
Setting up the surroundings:
- Product : in that location are 2 options: AutoCAD P&ID and AutoCAD Institute 3D. Check the trial versions available at http://usa.autodesk.com/products/free-product-trials.
From the API perspective, the second includes the starting time. An application adult for P&ID tin can load on Plant 3D and work according to the current projection/drawing type.
- Develop interface : to develop for AutoCAD P&ID and Establish 3D we need a programming environment.
The P&ID/Institute 3D API was adult in .Cyberspace, which means we tin can use any .NET programming language, where VB.NET and C# are supported by Autodesk. Information technology's likewise possible to use Managed C++, also supported, just recommended for advanced developers.
Microsoft offers the Visual Express edition to get started, but keep in listen that the version 2010 is required for AutoCAD 2013 based products. Brand certain yous download either Visual C# 2010 Express or Visual Basic 2010 Express.
There is no relevant difference between C# to VB.NET regarding API features, so it'due south a matter of which ane yous fell more than confortable. Anytime you find code on one language and desire to translate to the other, consider interpret using online services like Programmer Fusion. Near of posts on this web log are in C#.
- SDK : the software development kit (SDK) contains all the files required to compile the code. Download it from ADN P&ID/Found 3D Developer Center, brand sure you download the proper version, e.yard. 2013. As this product is based on AutoCAD, we also demand to download the AutoCAD SDK (again make sure you select 2013).
Due changes on the APIs, 2012 is non compatible with 2013, then applications developed for 2012 will not load on 2013. Some code alter may be required before recompile.
Documentation is available under \Plant SDK 2013\docs\ binder. The plantsdk_dev.chm file is like a book, with first steps at the beginning and the topics accelerate throughout the reading. Now the plantsdk_ref.chm contains a full list of API objects and methods, useful for daily basis consult.
The SDK also contains several interesting samples under \Plant SDK 2013\Samples\ folder. The same applies to AutoCAD SDK under \ObjectARX 2013\samples\.
With all the above downloaded and installed, launch Visual C# Express or Visual Bones Limited. Hither I'll show some images on Visual C#. Go to bill of fare 'File', then 'New Projection'. On the window, select 'Class Library' as project type, finally give it a name, that cannot contains spaces or showtime with numbers (eastward.g. MyFirstPlant3DApp).
At present, post-obit the image beneath, (ane) go to 'Solution Explorer' palette. If you cannot run into it, go to menu 'View', then submenu 'Other Windows' and select information technology. Now (2) right click on references to 'Add Reference'.
On the window that opens (not shown), click on 'Browse' and navigate to AutoCAD SDK folder. Nether \ObjectARX 2013\inc\ select AcMgd.dll, AcCoreMgd.dll and AcDbMgd.dll. These references volition be used to admission AutoCAD bones features required to build an awarding, such as command line and option mechanism.
Now to add P&ID and/or Plant 3D references, navigate to \Institute SDK 2013\inc-x64\ or \Constitute SDK 2013\inc-win32\ depending on your Bone configuration. References prefixed with PnID*** are for P&ID and Plant 3D, references prefixed with PnP3d*** are for Constitute 3D merely.
All AutoCAD and P&ID/Plant3D references must be marked with Copy Local equals simulated. This is extremely important. Otherwise, AutoCAD may crash unexpected.
At present you lot have a .NET projection ready to employ any C# sample bachelor at this weblog, endeavour any sample for P&ID or Plant 3D.
After copy & paste any sample code or write your ain, go to menu 'Debug' so 'Build Solution', which will build a .dll, for this sample project, it should exist at bin\Release\MyFirstPlant3DApp.dll (Visual Express ever create .dll at Release folder for Build and at Debug folder while debugging, pay attention).
At present beginning AutoCAD P&ID/Establish 3D and run NETLOAD command, choose the .dll generated by your project, finally run the custom command.
By Marat Mirgaleev
Issue
I would like to customize AutoCAD Constitute 3D for my company needs. Is there any API for this? How can get it?
Solution
A adept indicate to start with is the page on the Autodesk Developer Center, describing the API for AutoCAD P&ID and AutoCAD Plant 3D:
http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=15460551
The API for these two products is called Establish SDK and can be downloaded from the page mentioned above. It includes documentation, lawmaking samples, include files and libraries for C++ development and .Cyberspace libraries.
Past Marat Mirgaleev
Event
I would similar to get notified when some data changed in the project database. Which event shall I subscribe for?
Solution
You will need to create an upshot handler for the DataLinksManager.DataLinkOperationOccurred result. This is a code sample:
static private bool _isActive = true ; // To avoid recursion
// Event Handler
//---------------------------------------------------------------
public static void dlm_DataLinkOperationOccurred( object sender,
DataLinkEventArgs e)
{
if (e.Activity == DataLinkAction .RowModified && _isActive)
{
try
{
DataLinksManager dlm = PlantApplication .CurrentProject.
ProjectParts[ "Piping" ].DataLinksManager;
if (dlm.HasProperty(due east.RowId, "MyProperty" ))
{
StringCollection props = new StringCollection ();
props.Add( "Size" );
props.Add together( "Spec" );
StringCollection values = cipher ;
values = dlm.GetProperties(e.RowId, props, true );
PpObjectIdArray ppoids = dlm.FindAcPpObjectIds(e.RowId);
StringCollection newprops = new StringCollection ();
newprops.Add( "MyProperty" );
StringCollection newvals = new StringCollection ();
newvals.Add(values[0] + values[one]);
_isActive = false ;
dlm.SetProperties(ppoids.Showtime.Value, newprops, newvals);
}
}
grab
{
Organisation.Diagnostics. Debug .WriteLine(
"Error in the Event Handler:\due north{0}" , e.ToString() );
}
finally
{
_isActive = true ;
}
}
}
// Subscribe to the event
//---------------------------------------------------------------
[ CommandMethod ( "AddEventHandler" , CommandFlags .Modal)]
public static void AddEventHandler()
{
try
{
DataLinksManager dlm = PlantApplication .CurrentProject.
ProjectParts[ "Pipe" ].DataLinksManager;
dlm.DataLinkOperationOccurred +=
new DataLinkEventHandler (dlm_DataLinkOperationOccurred);
}
take hold of ( Exception e)
{
System.Windows.Forms. MessageBox .Show(eastward.ToString(),
"Cannot add the Event Handler" );
}
}
// Remove the subscription
//---------------------------------------------------------------
[ CommandMethod ( "RemoveEventHandler" , CommandFlags .Modal)]
public static void RemoveEventHandler()
{
try
{
DataLinksManager dlm = PlantApplication .CurrentProject.
ProjectParts[ "Piping" ].DataLinksManager;
dlm.DataLinkOperationOccurred -=
new DataLinkEventHandler (dlm_DataLinkOperationOccurred);
}
catch ( Exception due east)
{
System.Windows.Forms. MessageBox .Show(e.ToString(),
"Cannot remove the Outcome Handler" );
}
}
By default all Autodesk Exchange App installers are built to deploy the App bundles to the %APPDATA%\Autodesk\ApplicationPlugin folder. This binder is specifically a Unmarried User install location, which means that if any other user logs onto the machine the App will demand to be reinstalled for that user to be bachelor, to that user.
The static install folder design (folders that cannot be inverse) was specifically designed to help developers featherbed the second stage installer issues that comes with installing plugins, particularly difficult in AutoCAD, for the All User installation scenario. The way this was handled was to include a dissimilar static folder designed to support loading apps for the All User installation model, this folder tin can exist establish in the %PROGRAMDATA%\Autodesk\ApplicationPlugins folder.
The question is, how do I change an Exchange App Installer from existence a Single User to an All User installer…
The respond - Information technology's all about changing the static folder installation path from the %APPDATA%\Autodesk\ApplicationPlugin (Single User) to %PROGRAMDATA%\Autodesk\ApplicationPlugins (All User). There are two ways that this tin be achieved:
1) From a DOS command window:
c:\>msiexec /i MyExhangeApp.msi INSTALLDIR=C:\ProgramData\Autodesk\ApplicationPlugins AUTODESK=C:\ProgramData\Autodesk
ii) You lot tin can edit the MSI directly using ORCA.exe and change the Directory Table->AUTODESK from AppDataFolder to CommonAppDataFolder
past Fenton Webb
If you are new to Plant3d, it's tempting to quickly obtain project information directly from the Project.xml file.
The Project.xml file is an internal project file that should not really be used to extract Establish data. You should always use the API's because the XML file format can alter from release to release.
Take, for example, obtaining the list of P&ID drawings in AutoCAD P&ID. In 2011, you could
i) Read the Project.xml…
<ProjectPart name="PnId" fileName=" C:\Fenton\Projects\PnID\Test ISO\PnIdPart.xml" relativeFileName="PnIdPart.xml" uncFileName=" \\Fenton\Projects\PnID\Exam ISO\PnIdPart.xml" />
ii) Then Use the "relativeFileName" value to locate the "PnIdPart.xml" file.
3) Open the "PnIdPart.xml" file and search for the XML cake named "<PnpDrawingFiles>"
iv) Finally, inside the "<PnpDrawingFiles>" cake, all the project drawing files are listed.
However, in P&ID 2013 these elements don't exist anymore. This is considering we had issues with multi-user support, so we moved the file listing into the DCF.
The correct way to obtain a listing of P&ID DWG files is to use the API
Autodesk.ProcessPower.ProjectManager.Project.GetPnPDrawingFiles()
Currently, for Plant3d 2012 and 2013 it's not possible to use the PlantProject.LoadProject() function. The problem is that the Projection Manager does not update.
The solution is to use the control line "-OPENPROJECT", here'south how:
// open Plant3d project.xml past Fenton Webb, DevTech, 17/9/12
[ CommandMethod ( "OpenMyProject" )]
public void OpenMyProject ()
{
// select project.xml
Arrangement . Windows . Forms . OpenFileDialog dlg = new Organisation . Windows . Forms . OpenFileDialog ();
DirectoryInfo defaultPathDI = new DirectoryInfo ( Environment . GetFolderPath ( Environs . SpecialFolder . MyDocuments ));
dlg . InitialDirectory = defaultPathDI . FullName ;
dlg . FileName = "projection.xml" ;
dlg . Multiselect = faux ;
System . Windows . Forms . DialogResult dlgResult = dlg . ShowDialog ();
// if ok
if ( dlgResult == System . Windows . Forms . DialogResult . OK )
{
AcadApp . DocumentManager . MdiActiveDocument . SendStringToExecute ( "-_.OPENPROJECT \"" + dlg . FileName + "\"\n" , true , imitation , true );
}
}
If the LoadProject() was working you would apply information technology similar this…
[ CommandMethod ( "loadMyProject" )]
public void loadProject ()
{
// select project.xml
System . Windows . Forms . OpenFileDialog dlg = new System . Windows . Forms . OpenFileDialog ();
DirectoryInfo defaultPathDI = new DirectoryInfo ( Environment . GetFolderPath ( Environment . SpecialFolder . MyDocuments ));
dlg . InitialDirectory = defaultPathDI . FullName ;
dlg . FileName = "projection.xml" ;
dlg . Multiselect = false ;
System . Windows . Forms . DialogResult dlgResult = dlg . ShowDialog ();
// if ok
if ( dlgResult == System . Windows . Forms . DialogResult . OK )
{
PlantProject pp = PlantProject . LoadProject ( dlg . FileName , true , "" , "" );
PlantApplication . SetCurrentProject ( pp , true );
}
}
by Fenton Webb
Iso symbols are not represented in the project database like other piping model objects. They are "markers" that are only used by the Isometrics characteristic and reside entirely inside the DWG file.
Iso symbols are connected to existing fittings via a symbolic ports (non represented in projection database) that must exist added to the fitting AND to the Isometric symbol itself. No connector entity is involved with symbol connections.
Hither is some pseudo code containing additional comments about what needs to be done:
// ....
// ....
if ( Endpoints . size () > 0)
{
AcPpDb3dIsoSphereSymbol * isSymbol = new AcPpDb3dIsoSphereSymbol ();
isSymbol -> setPosition ( Endpoints . at (0). getAcGePoint3d ());
AcDbObjectId curSpace = curDoc ()-> database ()-> currentSpaceId ();
AcDbBlockTableRecordPointer curSpace ( curSpace , AcDb :: kForWrite );
pBlockTable -> getAt ( ACDB_MODEL_SPACE , pBlock , AcDb :: kForWrite );
// TODO:
// set isSymbol properties
// setBlockId(), setPosition(), setRadius(), setLayer()
// add a new symbolic port to
//
AcPp3dPort port ;
port . setIsSymbolic ( true );
port . setPosition ( isSymbol -> position ());
port . setDirection ( AcGeVector3d (0,0,1)); // set direction correctly
port . setName ( L "Symbolic" );
isSymbol -> addPort ( port );
AcDbObjectId isSymbolBlockId ;
int appendConnectorEntryError = pBlock -> appendAcDbEntity ( isSymbolBlockId , isSymbol );
// TODO:
// open up the fitting yous desire to connect to kForWrite; AcPpDb3dPart derived
// open fitting denoted by pPart beneath
//
AcPp3dPort port1 ;
port1 . setIsSymbolic ( true );
AcString symbolicPortName = pPart -> generateDynamicPortName ( true );
port1 . setName ( symbolicPortName . kACharPtr ());
port1 . setPosition ( pSymbol -> position ());
// set direction correctly
port1 . setDirection ( AcGeVector3d (0,0,-1));
// this is the plumbing fixtures the iso symbol is going to exist connected to
pPart -> addPort ( port1 );
isSymbol -> close ();
// TODO: use AcPpDb3dConnectionManager to connect iso symbol to fitting
// port to port1 connection on respective objects
past Fenton Webb
I was looking into the DLL dependency list of the Plant3d 2013 .NET API and thought you guys might need to refer to information technology also, so I have posted information technology hither for you to enjoy!
Acdbmgd
Depends On
Microsoft.VisualBasic
Microsoft.VisualC
mscorlib
PresentationCore
PresentationFramework
Organization
System.Cadre
Organisation.Drawing
Arrangement.Xml
WindowsBase
PnIDDwgValidation
Depends On
accoremgd
Acdbmgd
Acmgd
AdWindows
mscorlib
PnIDmgd
PnIDMgdInternal
PnPCommonDbxMgd
PnPCommonMgd
PnPCommonUIMgd
PnPCommonUIMgdCs
PnPDataLinks
PnPDataObjects
PnPHelpHookup
PnPProjectManagerMgd
PnPValidation
Arrangement
System.Cadre
System.Drawing
System.Windows.Forms
PnIDmgd
Depends On
Acdbmgd
Microsoft.VisualC
mscorlib
PnPCommonDbxMgd
System
PnIDProjectPartsMgd
Depends On
Acdbmgd
mscorlib
PnIDmgd
PnPCommonMgd
PnPDataLinks
PnPDataObjects
PnPProjectManagerMgd
Arrangement
System.Xml
PnP3dConnectionManager
Depends On
Microsoft.VisualC
mscorlib
PnP3dPartsRepository
PnPCommonMgd
PnPDataObjects
Organisation
System.Xml
PnP3dDataLinkManager
Depends On
Microsoft.VisualC
mscorlib
PnP3dPartsRepository
PnPDataLinks
PnPDataObjects
System
PnP3dObjectsMgd
Depends On
Acdbmgd
Microsoft.VisualC
mscorlib
PnP3dDataLinkManager
PnP3dPartsRepository
PnPDataLinks
Organization
PnP3dOrthoProjectPart
Depends On
accoremgd
Acdbmgd
Acmgd
Autodesk.AutoCAD.Interop
mscorlib
PnPDataLinks
PnPDataObjects
PnPDwg2dDef
PnPProjectManagerMgd
PnP3dPartsRepository
Depends On
mscorlib
PnPCommonMgd
PnPDataObjects
System
Organisation.Information
Organisation.Xml
WindowsBase
PnP3dProjectPartsMgd
Depends On
accoremgd
Acdbmgd
mscorlib
PnP3dConnectionManager
PnP3dDataLinkManager
PnP3dPartsRepository
PnPCommonDbxMgd
PnPCommonMgd
PnPDataLinks
PnPDataObjects
PnPProjectManagerMgd
System
System.Data
System.Xml
PnPCommonDbxMgd
Depends On
Acdbmgd
Microsoft.VisualC
mscorlib
PnPDataLinks
Organisation
PnPCommonMgd
Depends On
mscorlib
PresentationFramework
Organisation
Arrangement.Windows.Forms
System.Xml
PnPDataLinks
Depends On
Acdbmgd
Microsoft.VisualC
mscorlib
PnPCommonMgd
PnPDataObjects
Organisation
System.Data
PnPDataObjects
Depends On
Microsoft.VisualC
mscorlib
PnPCommonMgd
System
System.Information
System.Xml
PnPDwg2dAnno
Depends On
Acdbmgd
Microsoft.VisualC
mscorlib
PnPCommonDbxMgd
PnPDataLinks
PnPDwg2dUtil
PnPProjectManagerMgd
PnPProjectManagerMgd
Depends On
accoremgd
Acdbmgd
Acmgd
Autodesk.AutoCAD.Interop
mscorlib
PnPCommonDbxMgd
PnPCommonMgd
PnPDataLinks
PnPDataObjects
PnPSchemaConverter
System
Arrangement.Drawing
System.Management
System.Windows.Forms
System.Xml
WindowsBase
PnPSQLiteEngine
Depends On
Microsoft.VisualC
mscorlib
mscorlib
PnPDataObjects
System
System.Data
System.Data
System.Data.SQLite
PnPValidation
Depends On
Acdbmgd
mscorlib
Arrangement
Organisation.Data.SQLite
Depends On
mscorlib
System
Organisation.Data
Organization.Transactions
accoremgd
Depends On
Acdbmgd
Microsoft.VisualC
mscorlib
PresentationCore
PresentationFramework
Arrangement
Arrangement.Core
WindowsBase
Acmgd
Depends On
accoremgd
AcCui
Acdbmgd
AcDx
AcMr
AcTcMgd
AcWelcomeScreen
AcWindows
AdWindows
Microsoft.VisualC
mscorlib
PresentationCore
PresentationFramework
System
System.Core
System.Data
System.Drawing
System.Spider web
Arrangement.Windows.Forms
System.Xaml
WindowsBase
By Marat Mirgaleev
Issue
Is it possible to get the objectID by its PnPID or RowID?
Solution
Yes. It is a two steps procedure, because in that location is a one-to-many possibility.
PnPID and RowID are the aforementioned matter.
ane. DataLinksManager.FindAcPpObjectIds(rowId) --> collection of PpObjectId
2. DataLinksManager.MakeAcDbObjectId(ppObjId) --> converts PpObjectId to ObjectId
There are various flavors of those functions. The primary point to become beyond is that multiple AcDbObjectIds may be linked to a single RowID.
Here is a sample:
// Conversions of IDs back and along.
//------------------------------------------------------------------
[CommandMethod( "TestIds" )]
public static void TestIds()
{
// Gear up to the piece of work: Let'due south get some entity's ObjectId
Database db =
Awarding.DocumentManager.MdiActiveDocument.Database;
DataLinksManager dlm = DataLinksManager.GetManager(db);
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
ObjectId entId = ed.GetEntity( "Option a P&ID detail: " ).ObjectId;
// Now get the PnPID (i.e. PpObjectId)
// from the selected entity's ObjectId
PpObjectId pnpId = dlm.MakeAcPpObjectId(entId);
// At present allow's practice an contrary activeness - find ObjectId(s) of the entity
int rowId1 = dlm.FindAcPpRowId(entId); // Y'all can utilise ObjectId
int rowId2 = dlm.FindAcPpRowId(pnpId); // or PpObjectId
// rowId1 and rowId2 are e'er equal
PpObjectIdArray ids = dlm.FindAcPpObjectIds(rowId1);
// NOTE: Information technology returns a Collection of AcPpObjectId!
// I.e., multiple AcDbObjectIds may be linked to a unmarried RowID
// Now notice the ObjectID for each PpObjectId
foreach (PpObjectId ppid in ids)
{
ObjectId oid = dlm.MakeAcDbObjectId(ppid);
ed.WriteMessage( "\n oid=" + oid.ToString());
}
} // TestIds()
By Marat Mirgaleev
Issue
I would similar to show the Project Manager palette programmatically, if information technology's hidden. Can I do this?
Solution
In that location is an undocumented command chosen "_REFRESHPMESW" that shows the Project Manager. So, we can but phone call that command with these lines of code:
Document doc = Application .DocumentManager.MdiActiveDocument;
dr..SendStringToExecute( "_REFRESHPMESW " , true , false , truthful );
The "_REFRESHPMESW" control also refreshes the information in the window. It may exist helpful when your program changes the project structure.
Source: https://adndevblog.typepad.com/autocad/plant3d/page/5/
0 Response to "autocad plant 3d 2018 drawing exploded when converted"
إرسال تعليق