LinePattern definition from GraphicsStyle

LinePattern definition from GraphicsStyle

homer_anave
Contributor Contributor
1,514 Views
5 Replies
Message 1 of 6

LinePattern definition from GraphicsStyle

homer_anave
Contributor
Contributor

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.

0 Likes
1,515 Views
5 Replies
Replies (5)
Message 2 of 6

gopinath.taget
Alumni
Alumni

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

0 Likes
Message 3 of 6

gopinath.taget
Alumni
Alumni

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

0 Likes
Message 4 of 6

homer_anave
Contributor
Contributor

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.

0 Likes
Message 5 of 6

gopinath.taget
Alumni
Alumni

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.

LinePattern(String)

 

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

 

 

0 Likes
Message 6 of 6

Anonymous
Not applicable

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; }

 

0 Likes