Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Is possible create workset from api?

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Anonymous
3185 Views, 4 Replies

Is possible create workset from api?

Hi every one
I developed my addin revit using c# 2012, this app creates a document revit in a default route with a my custom template. i need create a new document with worksets included.
 
In the window (app) the user must select the especiality, select path save file, write workset name and press "create file" button. the app will create a document with worksets. this is possible?, there are some example of how to do it?
 
Thanks
4 REPLIES 4
Message 2 of 5
rosalesduquej
in reply to: Anonymous

Hi Marcos,

 

Yes it is possible now to create a workset from the API, the method got introduced in Revit 2015 UR2 and is now available in Revit 2016.

 

Here I'm providing you a small snippet of code that you can use in order to create a workset. 

 

If you want to know a bit more about Worksets and the API check this link

http://help.autodesk.com/view/RVT/2016/ENU/?guid=GUID-4BC148EC-6288-495A-A6DD-1524F326B32C

 

public Workset CreateWorkset(Document document)
{
    Workset newWorkset = null;
    // Worksets can only be created in a document with worksharing enabled
    if (document.IsWorkshared)
    {
        string worksetName = "New Workset";
        // Workset name must not be in use by another workset
        if (WorksetTable.IsWorksetNameUnique(document, worksetName))
        {
            using (Transaction worksetTransaction = new Transaction(document, "Set preview view id"))
            {
                worksetTransaction.Start();
                newWorkset = Workset.Create(document, worksetName);
                worksetTransaction.Commit();
            }
        }
    }

    return newWorkset;
}

Hope this helps you, pleae let me know how it goes.



Jaime Rosales D.
Sr. Developer Consultant
Twitter | AEC ADN DevBlog
Message 3 of 5
Anonymous
in reply to: Anonymous

Hi everyone

I created a menu similar a properties panel of revit, where it located the system type parameter native of revit. When selecting a pipe, the system type list available systems.

 
but i have a problem, if i select a system, the systemtype parameter does not update the value of the selected object.
 
Sin título.png

 

you can update the value of the system type through api revit?
or a limitation of the api? there an example?

 

Thanks

 

Message 4 of 5
Anonymous
in reply to: Anonymous

This question should be added to a new thread and not added to an unrelated one.

Message 5 of 5

thanks for your help.

Is it possible through this method to change workset parameters, for eample  "IsEditable" Parameter?

 

Thanks.

 

César

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

Post to forums  

Forma Design Contest


Rail Community