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

Re: What version of Visual Studio for this project?

$
0
0

Was able to build it in 2013 for 2020, file attached.

 

Had to comment out the following as it is no longer valid:

 

//public void OnDaylightPortal( DaylightPortalNode node )
//{
//}

 

Apparently a lot has changed with the exporter since this was written so not sure if the results will be as desired.


Re: Modeless Revit form treeview expand hang

$
0
0

So it also hangs if the user manually calls the ExpandAll (from a button or whatever)?

Have you tested only expanding the first node?

Re: What version of Visual Studio for this project?

$
0
0

 wrote:

Was able to build it in 2013 for 2020, file attached.

 

Had to comment out the following as it is no longer valid:

 

//public void OnDaylightPortal( DaylightPortalNode node )
//{
//}

 

Apparently a lot has changed with the exporter since this was written so not sure if the results will be as desired.


 

Do you mind trying to build the Exporter to XML?

 

I am so frustrated, that am considering using the Navisworks API instead.

 

-Ramon
JFK Numbers

 

Re: Autodesk.Revit.UI.UIDocument.PromptToPlaceViewOnSheet

$
0
0

I don't think the UI aspect has changed so you'll probably still have to use:

 

ScheduleSheetInstance.Create

Re: What version of Visual Studio for this project?

$
0
0

It builds but it doesn't run, probably a required value is not set somewhere. This is an old file and they've changed the rendering mechanism in Revit since, there were a lot of changes to IExporter for that at the time.

Re: Collect elements from link document in view of host document

Set MaterialId of Integral Wall Sweep

$
0
0

I created a macro to change the materials used by integral wall sweeps defined in a wall type.  It appears the code does nothing.  I've tested in 2019 and 2021.  What am I missing?

public void ReplaceWallSweepMaterial() { UIDocument uidoc = this.ActiveUIDocument; Document doc = this.ActiveUIDocument.Document; Reference wallRef = uidoc.Selection.PickObject(ObjectType.Element, "Pick Wall"); Wall wall = doc.GetElement(wallRef) as Wall; WallType elementToMod = doc.GetElement(wall.GetTypeId()) as WallType; var compoundStructure = elementToMod.GetCompoundStructure(); using (Transaction t = new Transaction(doc, "Update sweep material")) { t.Start(); var sweeps = compoundStructure.GetWallSweepsInfo(WallSweepType.Sweep); foreach (WallSweepInfo sweepInfo in sweeps) { //change the element id to a different material sweepInfo.MaterialId = new ElementId(164754); } //unsure if this is needed... elementToMod.SetCompoundStructure(compoundStructure); t.Commit(); } }

 

To run this, you need a wall type with one or more wall sweeps defined.  Get the id of a material to use (164754 is Copper in the Imperial-Architecture template) .  Then pick a placed wall to update.  I've attached a 2021 test file.  Thanks.

Re: What version of Visual Studio for this project?

$
0
0

  this seem to be working now, code was pointing to a hardcoded output path.

 

 


Re: What version of Visual Studio for this project?

$
0
0

 wrote:

  this seem to be working now, code was pointing to a hardcoded output path.

 

 


Thomas: I downloaded and built your Custom Exporter Collada in VS-2017.

 

The only change needed was switching to Target .NET Framework to 4.7.1

 

Thanks!

 

-Ramon
JFK Numbers

 

Re: Set MaterialId of Integral Wall Sweep

$
0
0

The below as I have updated it seems to work but I believe there is a slight bug. For fixed sweeps the id needs to be a positive number but it also doesn't like the id being 0. The sweep as existed in your project file had it's ID set to 0. If this was created in the UI then that may explain that or perhaps you created it in the API elsewhere and set the id to 0?

 

If the method accepted 0 then you would just need to call .AddWallSweep but since it doesn't like the 0 based id you have to bump all the id's up by removing the sweep and re-adding. You have to call .AddWallSweep to insert the information back into the compound structure.

 

Note the below extract from the RevitAPI.chm, the bits underlined should probably read "a value greater than 0".

 

WallSweepInfo.Id

"If the wall sweep belongs to a vertically compound structure, this must be a non-negative value. If the wall sweep belongs to a sweep defined outside of compound structures by UI or API the id will typically be -1 and is not used."

 

CompundStructure.AddWallSweep

"The id field of the WallSweepInfo must be populated with a non-negative integer value. If there already is a sweep defined for this id, its parameters will be changed. A new sweep will be created if no existing one has matching id."

 

 

public void ReplaceWallSweepMaterial() { UIDocument uidoc = this.Application.ActiveUIDocument; Document doc = this.Document; Reference wallRef = uidoc.Selection.PickObject(ObjectType.Element, "Pick Wall"); Wall wall = doc.GetElement(wallRef) as Wall; WallType elementToMod = doc.GetElement(wall.GetTypeId()) as WallType; var compoundStructure = elementToMod.GetCompoundStructure(); using (Transaction t = new Transaction(doc, "Update sweep material")) { t.Start(); List<WallSweepInfo> ModSW = new List<WallSweepInfo>(); IList<WallSweepInfo> sweeps = compoundStructure.GetWallSweepsInfo(WallSweepType.Sweep); foreach (WallSweepInfo sweepInfo in sweeps) { //change the element id to a different material sweepInfo.MaterialId = new ElementId(164754); compoundStructure.RemoveWallSweep(WallSweepType.Sweep,sweepInfo.Id); sweepInfo.Id = sweepInfo.Id +1; compoundStructure.AddWallSweep(sweepInfo); } //unsure if this is needed... elementToMod.SetCompoundStructure(compoundStructure); t.Commit(); } }

 

 

 

 

Re: wall location line

$
0
0

Thank You for the reply , I got it.

Re: instance parameter or not ?

$
0
0

HI

Sorry, I made a mistake on this post, you can erase it...Sorry

Re: Window light transmittance

$
0
0

As far as I can tell from your question, you are not doing anything programmatically yourself, only using the standard Revit user interface, correct?

 

In that case, unfortunately, this is not the best place to ask such a question.

 

Please note that this discussion forum is dedicated to programming Revit using the Revit API.

 

Therefore, you cannot expect an answer to a question such as yours relating to installation, product usage or end user support issues here.

 

You should try one of the non-API Revit product support discussion forums instead for that:

 

https://forums.autodesk.com/t5/revit-api-forum/this-forum-is-for-revit-api-programming-questions-not-for/td-p/5607765

 

The people there are much better equipped to answer your question than us programming nerds.

 

If you are doing it programmatically, please be aware that the Revit API hardly ever supports any functionality that is not also available in the user interface.

 

Therefore, if the UI does not support this, the API will probably not do so either.

 

So, it will always help to research the optimal manual approach to a solution first, before attacking the task programmatically.

 

I hope this clarifies.

 

Thank you for your cooperation and understanding.

 

Best regards,

 

Jeremy

 

Re: Revit 2020 Activation

$
0
0

What you should do I cannot tell.

 

I can tell you what you should not do: ask the question in this forum.

 

Unfortunately, this is not the best place to ask such a question.

 

Please note that this discussion forum is dedicated to programming Revit using the Revit API.

 

Therefore, you cannot expect an answer to a question such as yours relating to installation, product usage or end user support issues here.

 

You should try one of the non-API Revit product support discussion forums instead for that:

 

https://forums.autodesk.com/t5/revit-api-forum/this-forum-is-for-revit-api-programming-questions-not-for/td-p/5607765

 

The people there are much better equipped to answer your question than us programming nerds.

 

I hope this clarifies.

 

Thank you for your cooperation and understanding.

 

Best regards,

 

Jeremy

 

Re: Display an image loaded in memory via the .NET API.

$
0
0

This is certainly possible.

 

However, please be aware that the Revit API hardly ever supports any functionality that is not also available in the user interface.

  

Therefore, if the UI does not support this, the API will probably not do so either.

  

So, it will always help to research the optimal manual approach to a solution first, before attacking the task programmatically.

  

If you do not wish to affect the model in any way whatsoever, you can go ahead and do your dirty deed with the native Windows API and .NET libraries.

 

Going down that road, however, you might get into conflict with the Revit user interface.

 


Re: Local file creation problem

$
0
0

Dear Daniel,

 

Thank you for your query.

 

However, just as Michel already pointed out, this is not the best place to ask such a question.

 

Please note that this discussion forum is dedicated to programming Revit using the Revit API.

 

Therefore, you cannot expect an answer to a question such as yours relating to installation, product usage or end user support issues here.

 

You should try one of the non-API Revit product support discussion forums instead for that:

 

https://forums.autodesk.com/t5/revit-api-forum/this-forum-is-for-revit-api-programming-questions-not-for/td-p/5607765

 

The people there are much better equipped to answer your question than us programming nerds.

 

I hope this clarifies.

 

Thank you for your cooperation and understanding.

 

Best regards,

 

Jeremy

 

Re: Filter point based family

$
0
0

Hy Michel,

 

thanks for your answer, i was looking this, but instead for instances Location type I was looking for familsymbols.

Here is the code which I tried first, but didn't work:

FilteredElementCollector collector = new FilteredElementCollector(doc); IList<Element> symbols = collector.OfClass(typeof(FamilySymbol)).WhereElementIsElementType().ToElements(); IList<Element> lpSymbols = new List<Element>(); foreach (Element symbol in symbols) { if (symbol.Location is LocationPoint) { lpSymbols.Add(symbol); //FamilySymbol has a point location } else { //FamilySymbol has a curve Location } } TaskDialog.Show("Location", $"There are totally {symbols.Count} FamilySymbols from which are {lpSymbols.Count} with LocationPoint");

 

The lpSymbols.Count return 0. I think the type of the Location returns back as Location and not as LocationPoint or LocationCurve.

 

Here is a code which works, but not "Elegant" and because of the try cath si very slowly.

 

I loop trough all FamilySymbols (type and NOT instances) in the project.

Firstly I add the FamilSymbol to the lpSymbols List (this list should contain all FamilSymbols with a Location of LocationPoint type), then try to place it with the 4th overloadmethod of the Creat.NewFamilyInstance method (NewFamilyInstance Method (XYZ, FamilySymbol, StructuralType) ). If this throw an Exeption then I remove it from the lpSymbols List.

 

using (Transaction trans = new Transaction(doc, "FamilySymbols with LocationPoint")) { trans.Start(); foreach (var symbol in symbols) { lpSymbols.Add(symbol); try { doc.Create.NewFamilyInstance(new XYZ(), symbol as FamilySymbol, Autodesk.Revit.DB.Structure.StructuralType.NonStructural); } catch (Exception) { lpSymbols.Remove(symbol); } } trans.RollBack(); }

 

 

Has anybody a better solution 🙂 ?

 

Best Regards,

Lehel

Re: Modeless Revit form treeview expand hang

$
0
0

Hi,

 

I did some tests and found the following:

 

- Changing the treeView2.ExpandAll() to  treeView2.Nodes[0].Expand() still causes the routine to hang.

 

- I added a button which ran ExpandAll() on treeView2 - this works fine with no hang.

 

- I tried running the routine on a different project of a similar size and complexity - this worked fine, no hang.

 

Just as a though I tried moving the ExpandAll() statement outside of the BeginUpdate - EndUpdate statements - and so my surprise this worked fine!!

 

So maybe its something to do with beginUpdate / EndUpdate not liking the ExpandAll statement on this particular project? I Googled this and couldn't find any information on this being an issue...

Re: ID of elements is changes when a family is opened from a project

$
0
0

Re: Set Line weight in mm for a DetailLine

$
0
0

Hi,

 

Thanks for your answer.

 

You're right. My code isn't wright. That's why I'm searching for a better solution.

 

How could I change only the DetailLine instance line weight ? In mm if possible.

Viewing all 66683 articles
Browse latest View live


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