Just wanting to confirm the ElementId of the "Solid" LinePattern. When I retrieve the list of LinePatternElements using a FilteredElementCollector it retrieves all of the line patterns except the built in "Solid" line pattern. Using the RevitLookUp addin I was able to determine the ElementId of the solid linePattern is -3000010 but I just wanted to confirm that this doesn't change between flavours and versions of Revit, and also ask if there is another way to retrieve the ElementId of the "solid" linePattern?
Solved! Go to Solution.
Solved by Joe.Ye. Go to Solution.
Solved by Joe.Ye. Go to Solution.
It does not show up in the list when you select "Line Patterns" from the "Manage" ribbon tab, but will show up when you are assigning object styles or overriding graphics.
hi krispy / joe,
seems i've trouble to get that solid linePattern -3000010 either using lookup or coding, any chance to give a hint? thanks.
I used the "ProjectionLinePatternId" of the "OverrideGraphicSettings" of a category that I manually overrode the line pattern to be solid in Visibility/Graphics. This told me the ElementId of the "Solid" line pattern... I have been able to use this value in my app to apply the solid line pattern as an override programatcially but have had to hard code the ElementId value in... just wanted to confirm that the Id is stable, or if there is another way to retrieve a reference to the solid line pattern.
uidoc.ActiveView.GetCategoryOverrides(categoryId).ProjectionLinePatternId;
Hi Krispy,
Our engineering team confirmed the negative Id value meaning as follow.
"egative element id values in Revit are generally specially designated ids that are known internally to the system. Because they are an internal representation, the Revit team reserves the right to change them when needed, but in all probability they won’t be changed. The number definitely won’t change between flavors of Revit (e.g. Architecture, LT) on the same version."
Our mentioned to get the solid line pattern element. I tested and it shows that we cannot filter out the solid line pattern using FilteredElementCollector. However I don't think it is a problem.
When we want to assign the solid line pattern to a override, we can just create a ElementId object and set its IntegerValue to -3000010. And then assign this ElementId object to the override. This can successfully change the target element's or category's line pattern to solid line pattern.
Here is the ShartDevelop code I used.
public void ReadElementOverwriteLinePattern()
{
Document doc = this.ActiveUIDocument.Document;
Selection sel = this.ActiveUIDocument.Selection;
ElementId id = new ElementId(-3000010);
Reference ref2 = sel.PickObject(ObjectType.Element,"Please pick another element");
Element elem2 = doc.GetElement(ref2);
Transaction trans = new Transaction(doc);
trans.Start("change cut line pattern");
OverrideGraphicSettings override2 = doc.ActiveView.GetElementOverrides(elem2.Id);
override2.SetCutLinePatternId(id);
doc.ActiveView.SetElementOverrides(elem2.Id,override2);
trans.Commit();
}
Thanks Joe, yes I was already doing that to assign the solid pattern. Thanks for the confirmation that there is no other way to get the solid line pattern programatically. I will continue to use the negative ElementId value until it breaks 😉
We cannot use the Revit lookup to see the solid line pattern. it is special element in revit.
I just found that Revit does provide an API to return the solid line pattern.
LinePatternElement.GetSolidPatternId() static method to return the solid line pattern Id.
The RevitAPI.chm documents says: Note that Solid is special. It isn't a line pattern at all -- it is a special code that tells drawing and export code to use solid lines rather than patterned lines. Solid is visible to the user when selecting line patterns.
So we don't need to worry about the changes of the id integer value. Just call the static method to get the ElementId.
For to change color with SETELEMENTOVERRIDES is so simply !
è doc.ActiveView.SetElementOverrides(ElementID,color )
But for to read of get color from (ElementID of Object) I not find
Have someone an direction to search?