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: 

Create Line Pattern Type?

14 REPLIES 14
SOLVED
Reply
Message 1 of 15
mfleming.stantec
7325 Views, 14 Replies

Create Line Pattern Type?

I'm trying to create a couple custom line patterns with Revit API in 2013.

 

Using the 2013 SDK sample CreateFillPattern I can retrive all line styles as well as assign them to grids.

 

I'm looking for a way to be able to CREATE new types.

 

Is this possible in 2013 API?

 

Matt

14 REPLIES 14
Message 2 of 15

Dear mfleming.stantec,

 

as far as I know, there is no way to create new line patterns.

You can create new FillPatterns, but not LinePatterns.

 

I myself tried to create a new line pattern representing railroads or gas pipilines, for example, menaning I needed a line pattern containing text.

I need to work around the problem, ending in using a new line-based Family with parameters to set the text properties.

Resulting in something like "---GAS---GAS---GAS---" or "=|=|=|=|=|=|=|=|=|=|=|=|=", for example.

For curves, the distribution of FamilyInstances needs to be approximated to adjust the straigt elements to curved ones.

 

 

Best regards,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Message 3 of 15

All I'm looking to do is create new line pattern, Set value to either Dash, Space,Dot ect and give the value.

It's not a "custom" line pattern.

 

There has to be a way to do this.

Message 4 of 15

Have you looked at the LinePattern class?

There is a LinePatternElement.Create method...



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

Message 5 of 15

Hi Jeremy,

 

so, it is possible to

-create new GraphicsStyles plus

-assigning user-defined LinePatterns to them ?

 

Bye,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Message 6 of 15
jeremytammik
in reply to: Revitalizer

Hi Revitalizer,

 

Sorry, I don't know off-hand. I would need a sample to explore.

 

Cheers, Jeremy.



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

Message 7 of 15
Revitalizer
in reply to: jeremytammik

Hi Jeremy,

 

I've created FillPatterns in many, many variations so far.

But I did not create LinePatterns yet.

 

I think it would only make sense to create such Elements if we also could create new GraphicsStyles for them.

If we only can assign new LinePattern to existing GgraphicsStyles, we just would *override* existing settings...

 

Perhaps you could blog about LinePatterns and how to create them ?

 

 

Cheers,

Rudolf




Rudolf Honke
Software Developer
Mensch und Maschine





Message 8 of 15
Joe.Ye
in reply to: Revitalizer

 

I happen to have some lines to create a line pattern.

 

private LinePatternElement CreateLinePatternElement(string patternName)
{
//Create list of segments which define the line pattern
List<LinePatternSegment> lstSegments = new List<LinePatternSegment>();
lstSegments.Add(new LinePatternSegment(LinePatternSegmentType.Dot, 0.0));
lstSegments.Add(new LinePatternSegment(LinePatternSegmentType.Space, 0.02));
lstSegments.Add(new LinePatternSegment(LinePatternSegmentType.Dash, 0.03));
lstSegments.Add(new LinePatternSegment(LinePatternSegmentType.Space, 0.02));

LinePattern linePattern = new LinePattern(patternName);
linePattern.SetSegments(lstSegments);

Transaction trans = new Transaction(doc);
trans.Start("Create a linepattern element");
LinePatternElement linePatternElement = LinePatternElement.Create(doc, linePattern);
trans.Commit();
return linePatternElement;
}



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Message 9 of 15

Hi joe.ye,

 

thank you for your code snippet !

 

Cheers,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Message 10 of 15

Thanks Joe

Message 11 of 15

Joe, how do I load the line pattern code you've provided into Revit?

Message 12 of 15
cmckeown
in reply to: mfleming.stantec

Hi,

 

Am i correct in saying you can not set line pattern to a category?

 

Regards


Chris

Message 13 of 15
jeremytammik
in reply to: cmckeown

Dear Chris,

 

If you can do it through the user interface, it is probably possible programmatically as well, and vice versa. Is it possible in the UI?

 

Best regards,

 

Jeremy



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

Message 14 of 15
chris.j.mckeown
in reply to: RocksterB

Hi Jeremy,

 

I found the below post on the Autodesk site just after I posted this question...

http://forums.autodesk.com/t5/Autodesk-Revit-API/Line-Patterns/m-p/3110368/highlight/true#M2163

 

Yes it is possible via the UI but according to Saikat it is not possible via API yet.

 

I haven't checked 2014 yet. I notice in 2011 they had the method to set it but must have caused an error, so they (the factory) removed it in 2012/3 never to be seen again?

 

Regards

 

Chris

Message 15 of 15
Dale.Bartlett
in reply to: Joe.Ye

Hi Joe, Do you have similar code to delete line patterns? Dale




______________
Yes, I'm Satoshi.

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community