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
Solved! Go to Solution.
Solved by Joe.Ye. Go to Solution.
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
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.
Have you looked at the LinePattern class?
There is a LinePatternElement.Create method...
Hi Jeremy,
so, it is possible to
-create new GraphicsStyles plus
-assigning user-defined LinePatterns to them ?
Bye,
Revitalizer
Hi Revitalizer,
Sorry, I don't know off-hand. I would need a sample to explore.
Cheers, Jeremy.
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
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;
}
Hi joe.ye,
thank you for your code snippet !
Cheers,
Revitalizer
Hi,
Am i correct in saying you can not set line pattern to a category?
Regards
Chris
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
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
Hi Joe, Do you have similar code to delete line patterns? Dale
Can't find what you're looking for? Ask the community or share your knowledge.