Revit API

Reply
Distinguished Contributor
krispy
Posts: 316
Registered: ‎11-01-2004
Message 1 of 12 (238 Views)
Accepted Solution

Solid LinePattern

238 Views, 11 Replies
11-25-2013 01:48 PM

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?

ADN Support Specialist
Joe.Ye
Posts: 321
Registered: ‎03-05-2010
Message 2 of 12 (208 Views)

Re: Solid LinePattern

11-27-2013 01:47 AM in reply to: krispy

Hi krispy,

I cannot see the LinePattern with the name of Solid. Do you mean the fill pattern? There is a fill pattern named Solid. However its id is 3. Thanks for your clarification.


Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Distinguished Contributor
krispy
Posts: 316
Registered: ‎11-01-2004
Message 3 of 12 (204 Views)

Re: Solid LinePattern

11-27-2013 01:57 AM in reply to: krispy
Hi Joe, thanks for replying. Yes I really mean the line pattern, it is the default pattern that doesn't have any dashes just a single continuous line.
Distinguished Contributor
krispy
Posts: 316
Registered: ‎11-01-2004
Message 4 of 12 (193 Views)

Re: Solid LinePattern

11-27-2013 01:22 PM in reply to: krispy

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.

ADN Support Specialist
Joe.Ye
Posts: 321
Registered: ‎03-05-2010
Message 5 of 12 (178 Views)

Re: Solid LinePattern

11-28-2013 08:00 PM in reply to: krispy
Thanks Krispy for the update.

yes, I see the solid line pattern now. And I can get its Id from an line pattern overrided element

However, using this ElementId (which value is -3000010.
And we can construct an ElementId with the value of -3000010. And then assign this ElementId to line pattern Id of the OverrideGraphicSettings object to change an element's line pattern.

With regard to the Id unique issue, as far as I know the negative value in Revit is stable. I am double checking with the team if this is the case.


Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Valued Contributor
Ning_Zhou
Posts: 86
Registered: ‎05-13-2013
Message 6 of 12 (166 Views)

Re: Solid LinePattern

12-01-2013 08:56 PM in reply to: krispy

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.

Distinguished Contributor
krispy
Posts: 316
Registered: ‎11-01-2004
Message 7 of 12 (164 Views)

Re: Solid LinePattern

12-01-2013 09:18 PM in reply to: krispy

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;

Valued Contributor
Ning_Zhou
Posts: 86
Registered: ‎05-13-2013
Message 8 of 12 (152 Views)

Re: Solid LinePattern

12-01-2013 10:22 PM in reply to: krispy
thanks krispy, it works, but how can i get it from lookup?
ADN Support Specialist
Joe.Ye
Posts: 321
Registered: ‎03-05-2010
Message 9 of 12 (145 Views)

Re: Solid LinePattern

12-01-2013 11:18 PM in reply to: krispy

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



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
Distinguished Contributor
krispy
Posts: 316
Registered: ‎11-01-2004
Message 10 of 12 (138 Views)

Re: Solid LinePattern

12-02-2013 01:34 PM in reply to: Joe.Ye

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 :smileywink:

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Revit Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Revit helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Revit

Twitter

Facebook

Blogs

Youtube