Quantcast
Channel: All Revit API Forum posts
Viewing all 67020 articles
Browse latest View live

Re: CreateReferenceInLink throwing exception

$
0
0

The forum placed my answer to the other thread into this one. Forum slow, user quick, problem ensues.

 

 

 


Notes on ViewSection

$
0
0

Hi! How to create notes like these with lines and etc?2019-10-16_16-50-24.png

Re: Stable representation of reference is not the same as original

$
0
0

Yes. sure. I answered you in the thread you point to.

  

Best regards,

 

Jeremy

 

Re: Independent Tag Color Help!

$
0
0

I ended up going this route.

 

 

 

View view = doc.ActiveView;
view.GetFilters();
IList<ElementId> categories = new List<ElementId>();
categories.Add(new ElementId(BuiltInCategory.OST_ConduitFitting));
List<Element> FAB_tagColl = new FilteredElementCollector(doc, doc.ActiveView.Id).OfCategory(BuiltInCategory.OST_ConduitFittingTags).Where(x => x is IndependentTag).ToList();
IList<FilterRule> rules = new List<FilterRule>();
Parameter systemparam = new FilteredElementCollector(doc).OfClass(typeof(FamilyInstance)).OfCategory(BuiltInCategory.OST_ConduitFitting).FirstElement().LookupParameter("System");

Transaction trans = new Transaction(doc);


using (Transaction t = new Transaction(doc, "Create and Apply Filter"))
{
//
}
string filterNames = "";

foreach (Element t in FAB_tagColl)
{
IndependentTag tag = t as IndependentTag;
MyTagName = tag.Name;


if (MyTagName == "Homerun Box Tag" ||
MyTagName == "JFA-Fabrication Duct - Bottom Of Duct Elevation Tag" ||
MyTagName == "JFA-Fabrication Duct - Flat or Set Tag" ||
MyTagName == "JFA-Fabrication Duct - Size Tag")

//this get filter names
foreach (ElementId id in view.GetFilters())
{

filterNames = doc.GetElement(id).Name;


//this gets every tag with "System" name
elem = doc.GetElement(tag.GetTaggedReference().ElementId);
Element MY_FAB_item = elem as Element;
String MyService = MY_FAB_item.LookupParameter("System").AsString();

if (MyService == "")
{
//if empty skip me

}
if (MyService == null)
{
//if null skip me
}
else
{

string red = "";
string green = "";
string blue = "";
if (MyService.Contains(filterNames))

{
trans.Start("Tag_Color");

//red value
red += view.GetFilterOverrides(id).ProjectionFillColor.Red;
int result1 = Int32.Parse(red);
Byte redbyte = Convert.ToByte(red);

//green value
green += view.GetFilterOverrides(id).ProjectionFillColor.Green;
int result2 = Int32.Parse(green);
Byte greenbyte = Convert.ToByte(green);

//Blue value
blue += view.GetFilterOverrides(id).ProjectionFillColor.Blue;
int result3 = Int32.Parse(blue);
Byte bluebyte = Convert.ToByte(blue);

Blue = bluebyte;
Red = redbyte;
Green = greenbyte;
MyColor = new Color(Red, Green, Blue);
ogs = new OverrideGraphicSettings();
ogs.SetProjectionLineColor(MyColor);
ogs.SetCutLineColor(MyColor);
doc.ActiveView.SetElementOverrides(t.Id, ogs);

trans.Commit();
//break;

}

Re: Best practice for multiple ExternalEvent modules

$
0
0

I don't think you can go wrong if you follow the SOLID principles when asking yourself a best practice question.  The first principle is the Single Responsibility Principle, which states, "Your solution explorer shall be overfilled with small classes that do one thing", paraphrasing, of course.

"Select a board" From This Forum

$
0
0

When selecting which board to post to, it clears ALL of my comments in the Details section, making it very user-unfriendly to use your website.

Re: Element.GetPhaseStatus returns None unexpectedly.

$
0
0

Thanks for  the reply.  It seems to occur for all elements in the Lighting Fixtures category in this model . See below for the code.  Status gets set  to "None" for the elements in question. Element.CreatedPhaseId and the phase, both refer to the new construction Phase

 

<Extension()>Public Function ValidPhase(element As Element, phase As PhaseAs Boolean    Dim status = ElementOnPhaseStatus.Existing    If phase IsNot Nothing Then        status = element.GetPhaseStatus(phase.Id)    End If

 

Re: Element.GetPhaseStatus returns None unexpectedly.

$
0
0

I tried to reproduce the result "GetStatus() = None" but i couldn't .  is it possible to send this revit file with only the lighting fixture. so I can look further? 


Re: populate combobox from a foreach loop

$
0
0

Hi Moustafa,

 

The list AddDateCmd should populate the combox2a.  My understanding is the DisplayMember is what populates the list and the ValueMember is the value that is passed thru when a DisplayMember item is selected. Right now IndexName and IndexValue are the same parameter.AsString().

Re: populate combobox from a foreach loop

$
0
0

well as i can see you are assigning the index and the index value the same values

new AddDateCmd { IndexName = parameter.AsString(), IndexValue = parameter.AsString() 

try this

new AddDateCmd { IndexName = parameter.Definition.Name, IndexValue = parameter.AsString() }

 

Re: Notes on ViewSection

Re: many section view in 1 sheet

$
0
0

Hi,

If you written a code that show us your trial to achieve your target, we would be happy to help you to a proper direction.

but basically you need

1. to create/Get a sheet view

2. create a view port and assign the view you need to place on the sheet

3. get the viewport width 

4. place the view port on the sheet at a distance greater from the sum of all previously placed views.

 

hope that helps

 

 

Re: Subcategory Hidden Line Colour

Re: Unable to import .SAT using ShapeImporter

$
0
0

can you attach the sat file to do some tests from my side?

Re: GET VALUE PARAMTER ONLY FAMILY

$
0
0

Well, what is the value of "_variables.cadena" at compile time? does it equal to "ARM_KILOS" ?


Re: ReferenceIntersector Get Normal at Intersection Points (mesh)

$
0
0

Hi,

just a quick though came up... what if you get the closest xyz point to the globalpoint, and cross product both points to get the normal?

Re: Replacing shared parameter with other type shared parameter

$
0
0

hi,

AFAIK you can't change that from the normal UI Interface, hence it would not be possible via API

 

Hope that helps

 

Re: GroupId returns null for mullions and nested families

$
0
0

I think it is logically correct, because you can have curtain wall in Group A and its mullions in GroupB. but I would suggest to filter out mullions and Grids from the collection, and assign the group ID to the Curtainwall (Host).

 

I think same logic would apply to the nested family as well.

Re: Element.GetPhaseStatus returns None unexpectedly.

$
0
0

  Yep, I'm also unable to reproduce with any other file.  I put the Revit model at the download link below.

 

https://lightinganalysts.sharefile.com/d/s618e8da563a47ac8

 

The 4 lighting fixtures highlighted in the attached screen shot exhibit this problem. All the other lighting fixtures I've tried have the same issue.  Thanks for looking!

Re: ReferenceIntersector Get Normal at Intersection Points (mesh)

$
0
0

 Yep, that's roughly what I ended up doing.  Works correctly.  But searching all the Mesh Vertices for the closest one can be a slow operation for complicated meshes. 

 

It would be handy if the ReferenceWithContext object returned by the Reference Intersector had a Normal, in addition to the global point.  Or if Meshes had a computeNormal method, like Faces do. 

Viewing all 67020 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>