A straightforward title...but is this possible?
The remarks section of the LinePattern class in the Revit API Help says LinePatterns are used in the definition of GraphicsStyle object. But it seems that I can't find a way to acquire the LinePattern from a GraphicsStyle object.
Hello,
I have enquired with the engineering team about this. I will get back to you as soon as I have some relevant information.
Thanks
Gopinath
Hello,
I am discussing this with my colleagues and the question came up as to what you want to do exactly. Do you have a use case on what you want to achive?
Thanks
Gopinath
One case is, we are trying to change a line pattern of an object that was imported from AutoCAD to a line pattern that is already defined in Revit.
To be more specific, linetypes of layers (that become GraphicsStyle objects) that are imported from AutoCAD are created anew in Revit. Even though linetype names in AutoCAD and line patterns in Revit shares the same name, Revit seems to ignore this and instead creates unique line patterns based on it. Since this is the case, we decided to change the imported linetypes (that became line patterns in Revit) of each converted GraphicsStyles to their proper equivalent line patterns programmatically with Revit API. But since we cannot find an API to change line patterns of GraphicsStyles, we are stuck and can't move further.
Hello,
It looks like there is no real API connecting GraphicsStyle to LinePattern. Apologies for the misleading documentation. One of my colleagues provided this info for creation of a line Pattern:
*---------
developers can create new line pattern element in Revit 2014.
Using the below constructor to create a LinePattern object.
Then call LinePattern.SetSegment() method to create customized line pattern.
Finally using the LinePattern object to create the LinePatternElement via LinePatternElement.Create(LinePattern)
*---------
Also this sample shows how the LinePatternElement can be set to an object (as a property): <RevitSDK2014>\Samples\CreateFillPattern\CS
Hope this helps.
Thanks
Gopinath
Different view can have different display LinePattern in same element.
so I guess the
View.ProjLinePatternOverrideByElement Property is away to acquire LinePattern.
C#
public LinePatternElement this[ ICollection<ElementId> ids ] { get; set; }