Creating a new Line Style

Creating a new Line Style

mm1452
Enthusiast Enthusiast
1,709 Views
4 Replies
Message 1 of 5

Creating a new Line Style

mm1452
Enthusiast
Enthusiast

Hi,

 

How can I add new line style via revit api?

 

thanks in advance

0 Likes
Accepted solutions (1)
1,710 Views
4 Replies
Replies (4)
Message 2 of 5

jeremytammik
Autodesk
Autodesk

I do nothing at all that cannot be shared and published, and share and publish absolutely everything I work on.

 

I therefore avoid discussing questions like this, and actually all questions whatsoever, one-on-one.

 

I prefer discussing everything in public and enabling the entire community to contribute and share:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#1

 

Therefore, please post your query as a question on the Revit API discussion forum, Stack Overflow, or a comment on an appropriate discussion on The Building Coder blog, both for knowledge sharing and so others can chip in with answers as well:

 

http://forums.autodesk.com/t5/Revit-API/bd-p/160
http://stackoverflow.com/questions/tagged/revit-api

 

Thank you!

 

That has several advantages. Among others, your peers can join in and help you, and our conversation becomes visible to others, to help them resolve their issues as well.

 

I know that you already did this:

 

http://forums.autodesk.com/t5/revit-api/creating-a-new-line-style/td-p/5941766/jump-to/first-unread-...

 

Thank you for that.

 

I wish you patience and good luck.

 

Alternatively, you can try to find a solution for yourself, e.g. by searching on the Internet and elsewhere.

 

I would have to do the same thing.

 

Maybe nobody is answering because the answer is out there already?

 

Best regards

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 5

jeremytammik
Autodesk
Autodesk

Sorry for this weird answer.

 

It happened because the public forum question was reposted as a private message.

 

I do not reply to private messages except in the manner that you can see above.

 

Thank you for your understanding!



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 4 of 5

Revitalizer
Advisor
Advisor
Accepted solution

Hi,

 

Settings settings = doc.Settings;
Categories cats = settings.Categories;
Category lineCat =  cats.get_Item(BuiltInCategory.OST_Lines);    

Category lineStyleCat = cats.NewSubcategory(lineCat, "MyLineStyle");
lineStyleCat.LineColor = new Color(0, 0, 255);
lineStyleCat.SetLineWeight(2, GraphicsStyleType.Projection);

 

 

Revitalizer

 

Edit: don't mark it as solved if the code does not work...

Changed

Category lineStyleCat = lineCat.NewSubcategory(lineCat, "MyLineStyle");

To

Category lineStyleCat = cats.NewSubcategory(lineCat, "MyLineStyle");

 

Now it will function as desired 😉




Rudolf Honke
Software Developer
Mensch und Maschine





Message 5 of 5

mm1452
Enthusiast
Enthusiast

Many Thanks, it works well

0 Likes