Is there any method to create new phase programmatically?

Is there any method to create new phase programmatically?

Anonymous
Not applicable
3,197 Views
7 Replies
Message 1 of 8

Is there any method to create new phase programmatically?

Anonymous
Not applicable

I have created a form to get the path of an excel file and i can successfully retrieve the data in the excel files. 

column 1 : Name

colume 2: Description

 

 

But i am wondering is there any method for me to add these data to phasing by API? 

 

 

Besides, Is there any method for us to add a new modifier  ( customized name  ) in Modify DWG/DXF Export Setup.

 

Thank you very much.

 

Ps. If yes, what version does it support.

0 Likes
Accepted solutions (1)
3,198 Views
7 Replies
Replies (7)
Message 2 of 8

Revitalizer
Advisor
Advisor

Hi,

 

to your first question, creating new Phase elements.

 

What about using the ElementTransformUtils.CopyElements method to copy an existing Phase from one Document to another one ?

I must admit that I didn't try this with abstract Elements like Phases so far.

 

This approach requires that you define a bunch of Phases by hand, in your source Document, with fixed names.

When needing a new Phase of a given name, you can get it from the source Document.

 

Just an idea.

 

If it would be possible to change a Phase's name, you could copy any Phase and rename it afterwards in the target Document, either changing its Name property value or one of its parameters (which may drive the Name property).

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 3 of 8

Anonymous
Not applicable

I extract those name and descriptions information from Excel into two string list , i.e. List<string> name 

 

I am currently developing API on 2013 version. 
I can only have limited functions provided by Phases class, i.e  doc.Phase.xxx

 

Is there any limitation on the revit version?

And can you please advise me the code for extracting current phase and the way to change its name.

Thank you very much/.

0 Likes
Message 4 of 8

Revitalizer
Advisor
Advisor
Accepted solution

Hi,

 

the ElementTransformUtils.CopyElements method overload I talked about was introduced in Revit 2014.

Sorry, no more ideas.

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 5 of 8

grahamcook
Advocate
Advocate

Just to add to this.  It appears that project phase elements cannot be copied between projects, nor within the same project for the matter.  I used the ElementTransformUtils.CopyElements method to try and copy a pre-configured phase from a "master" file into my source file and get the following exception:

 

"Project phases cannot be copied.  Parameter name: elementsToCopy".

 

I was working on 2017 but out of curiosity tried in 2018 as well with the same exception.

 

Graham Cook

Message 6 of 8

Revitalizer
Advisor
Advisor

Hi,

 

thanks for trying it out and sharing the result.

 

 

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes
Message 7 of 8

chema.jimenez
Participant
Participant

Hello everybody,

I refloat the toppic just to ask:

Is there any way do get the Description value of a phase?

 

Thanks!

0 Likes
Message 8 of 8

Mustafa.Salaheldin
Collaborator
Collaborator

Hello
I'm currently working on a project where I need to create a new phase and define its description with API.

Probably also I'll need to edit or remove it.

@jeremy_tammik is there any version that supports that demand?


¯\_(ツ)_/¯
Let it work like a charm.

Mustafa Salaheldin


EESignature




Digital Integration Manager, DuPod

Facebook | Twitter | LinkedIn

0 Likes