Last edited by EDDemtec; 2011-09-15 at 02:03 PM.
"Potential has a shelf life." - Margaret Atwood
Hi, the noob again !!!
I found the info below from the Objects Browser but I'm not sure how to use it...
I try with the code below, but the project seems to not be set current ???Code:Public Function SetCurrentProject(ByVal fullPath As String) As Boolean Membre de Autodesk.Aec.Project.ProjectBaseManager Résumé :Sets the current project. Paramètres :fullPath: Inputs the full path of the project. Valeurs de retour :True if sets successfully, otherwise false.
Thanks in advance !Code:Imports Autodesk.Aec.Project Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.DatabaseServices Public Class MyCommands <CommandMethod("prname")> _ Public Sub prname() Dim pjtMgr As ProjectBaseManager = ProjectBaseServices.Service.ProjectManager Dim pjtFileName As ProjectFileName = pjtMgr.CurrentProjectFileName Application.ShowAlertDialog(pjtFileName.Name) SetCurrentProject("D:\Autodesk\My Projects\HousePlan\HousePlan.apj") End Sub Public Function SetCurrentProject(ByVal fullPath As String) As Boolean Application.ShowAlertDialog(fullPath) End Function End Class
Hi Guys !
...continuing my research on this case, I found the text below !
Maybe the usage of _AecSetCurrentProject would be my best option...
Text reference see page 10/11
Code:Project Management API ACA .NET API now provides some project management API support. You are able to create and manipulate projects. All the support is provided at the file system level and there is no support for interacting with the Project Browser and Project Navigator UI directly from the API. The Project API consists of the following main classes: Autodesk.Aec.Project – The main project class. Autodesk.Aec.ProjectBaseManager – The system wide Project Manager. This contains many utility methods to manipulate projects. Autodesk.Aec.ProjectBaseServices – A helper class used to obtain the single ProjectBaseManager object. Autodesk.Aec.ProjectConfiguration – Contains information about the project (such as the name, description, and number). It also contains a number of classes to support different parts of the project. Tip: Use the following commands to help manipulate projects directly from your code. These are commands that will work when sent via your application to the command-line: _AecProjectNavigator – This a documented command that will display the project navigator palette. If there is no “current” project, the command will also run the Project Browser dialog. _AecRefreshProject – This refreshes mainly the palette. Note that the API has a different method to reload a project, but is different than this command. This command does the same as the refresh project button on the palette. _AecSetCurrentProject – This is an important command for the API user. This is currently the only way to properly set a project as current from the API. See sample code for an example. _AecCloseProjectNavigator – Closes the project navigator palette. Note it only closes the dialog and the same project is still open and current. _AecProjectNavigatorToggle – Simply toggles the project navigator palette on or off.
Last edited by EDDemtec; 2011-09-20 at 05:14 PM.
Have you looked at the AecProjectManagedBase example in the samples folder?
For _AecSetCurrentProject you just use Document.SendStringToExecute
You can also find your answers @ Theswamp
Yes I started from there...
However, I read somewhere that it is better to use "SendCommand" instead of "SendStringToExecute", I dont remember where...
Code:Public Class Class6 <CommandMethod("cpro")> _ Public Sub cpro() Dim appCAD As AcadApplication = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication Dim cmdCAD As String cmdCAD = "_AecSetCurrentProject" + vbCr + "Z:\PLANS\Annee 2011\Production\11030....apj" + vbCr appCAD.ActiveDocument.SendCommand(cmdCAD) End Sub End Class