Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: Project browser: Set current project

  1. #11
    100 Club
    Join Date
    2008-04
    Location
    St-Ferdinand, Québec
    Posts
    141
    Login to Give a bone
    0

    Default Re: Project browser: Set current project

    Quote Originally Posted by Jeff H View Post
    Have you set the property?

    and probably not the best idea to place the propety in a class with CommandClass Attribute.
    As I said above, I begin and I try a lot of things...

    Quote Originally Posted by Jeff H View Post
    Code:
    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)
            End Sub
    Your code works fine, Thanks !

    Quote Originally Posted by RenderMan View Post
    While I am not familiar with the Architecture Object Model (I'm a Land Desktop, Civil 3D guy)... The Visual Studio Object Browser (F2) is your friend.
    This reference AecProjectBaseMgd makes the difference, is there a place to learn what each reference can do ? Now in the Object Browser I see more objects that affects project...
    Last edited by EDDemtec; 2011-09-15 at 02:03 PM.

  2. #12
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Project browser: Set current project

    Quote Originally Posted by EDDemtec View Post
    This reference AecProjectBaseMgd makes the difference, is there a place to learn what each reference can do ? Now in the Object Browser I see more objects that affects project...
    Thanks for stepping in, Jeff.

    EDDemtec - Also note that in the Object Browser, to better narrow down your search, in the Browse: area, use the drop down menu to select 'My Solution'. This will narrow your listed references.

    HTH
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #13
    100 Club
    Join Date
    2008-04
    Location
    St-Ferdinand, Québec
    Posts
    141
    Login to Give a bone
    0

    Default Re: Project browser: Set current project

    Hi, the noob again !!!

    I found the info below from the Objects Browser but I'm not sure how to use it...
    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.
    I try with the code below, but the project seems to not be set current ???
    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
    Thanks in advance !

  4. #14
    100 Club
    Join Date
    2008-04
    Location
    St-Ferdinand, Québec
    Posts
    141
    Login to Give a bone
    0

    Default Re: Project browser: Set current project

    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.

  5. #15
    Active Member
    Join Date
    2009-08
    Posts
    93
    Login to Give a bone
    0

    Default Re: Project browser: Set current project

    Have you looked at the AecProjectManagedBase example in the samples folder?

    For _AecSetCurrentProject you just use Document.SendStringToExecute

  6. #16
    100 Club
    Join Date
    2008-04
    Location
    St-Ferdinand, Québec
    Posts
    141
    Login to Give a bone
    0

    Default Re: Project browser: Set current project

    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

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Current Project Path (Project Navigator)
    By jgardner.79905 in forum AutoLISP
    Replies: 0
    Last Post: 2010-07-10, 11:39 AM
  2. Project Browser "could not set current project"
    By bwarchitect in forum Project Navigator
    Replies: 4
    Last Post: 2009-02-12, 12:21 PM
  3. Project Browser - Adding your personal project inforamtion
    By warnoe uk in forum Project Navigator
    Replies: 0
    Last Post: 2006-06-01, 10:42 AM
  4. Changing a project parameter in plan view versus project browser
    By Nic M. in forum Revit Architecture - General
    Replies: 0
    Last Post: 2004-10-29, 12:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •