Revit API

Reply
Active Contributor
Posts: 46
Registered: ‎06-18-2003
Message 1 of 4 (446 Views)

How to Set Line Pattern in Line Style

446 Views, 3 Replies
12-10-2012 05:42 PM

I'm creating new line styles in Revit MEP 2013 through the API in VB.Net, and I've almost got everything figured out... except setting the line pattern. There doesn't seem to be a way to do this one, last step. Any ideas?

Here's what I have so far:

 

   

PublicFunction LoadStyle(ByVal n AsInteger) AsBoolean

       

Dim lineCat As Categories = m_RvtDoc.Settings.Categories

       

ForEach objCategory As Category In lineCat

           

If objCategory.Name = "Lines"Then

               

If objCategory.CanAddSubcategory = TrueThen

                   

Try

                       

Dim cat As Category = lineCat.NewSubcategory(objCategory, MEP(n, 6))

                       

'set color

                       

If MEP(n, 7) <> ""Then

                           

Dim r, g, b AsInteger

                            r = MEP(n, 7)

                            g = MEP(n, 8)

                            b = MEP(n, 9)

                           

Dim c As Autodesk.Revit.DB.Color = New Autodesk.Revit.DB.Color(r, g, b)

                            cat.LineColor = c

                       

EndIf

                       

'set lineweight

                       

If MEP(n, 11) <> ""Then

                            cat.SetLineWeight(

CInt(MEP(n, 11)), GraphicsStyleType.Projection)

                       

EndIf

                       

'set line pattern

                       

If MEP(n, 10) <> ""Then

                           

'cat.LinePatternId = GetElementByName(GetType(LinePatternElement), MEP(n, 10))

                       

EndIf

                   

Catch

                        MsgBox(

"Line style " & MEP(n, 6) & " already exists.", MsgBoxStyle.Information, "Load Systems Error")

                   

EndTry

                   

Exit For

               

Else

                    MsgBox(

"Can't add line style.")

                   

Exit For

               

EndIf

           

EndIf

       

Next

 

   

EndFunction

 

 

ADN Support Specialist
Posts: 311
Registered: ‎03-05-2010
Message 2 of 4 (412 Views)

Re: How to Set Line Pattern in Line Style

12-19-2012 01:51 AM in reply to: dhorger
Revit didn't expose the API to change category's line pattern. Revit engineering team already knew this request. Hope this will come not long.


Joe Ye
Developer Technical Services
Autodesk Developer Network
Active Contributor
Posts: 46
Registered: ‎06-18-2003
Message 3 of 4 (407 Views)

Re: How to Set Line Pattern in Line Style

12-19-2012 10:58 AM in reply to: Joe.Ye

Thanks for the response, Joe. Would it be possible to check to see if it's exposed in Revit 2014? And are there any workarounds? This is very important for my project.

 

Thanks,

 

Dave Horger

Interface Engineering, Inc.

ADN Support Specialist
Posts: 311
Registered: ‎03-05-2010
Message 4 of 4 (398 Views)

Re: How to Set Line Pattern in Line Style

12-19-2012 10:38 PM in reply to: dhorger
Thanks for your comments on the API wish. I passed on your comments on this request to the engineering team.


Joe Ye
Developer Technical Services
Autodesk Developer Network

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Revit Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Revit helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Revit

Twitter

Facebook

Blogs

Youtube