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

Re: Annotation Tag placement


Re: Creating Materials With Appearance asset

$
0
0

I Finally managed to do it.. It was  pretty Simple...All i had to do was duplicate a asset and apply  to all the materials created thru API

How to access a Railing's slope options through API?

$
0
0

We can select a railing's slope option through Revit UI(manually):

"Edit Path"->pick a sketch line->then pick an option (By Host, Flat, or Sloped) on Revit UI.

 

Can I do this through Revit API? If yes, how?

 

I notice there is an Enumeration called "RailingSlopeOption " in Revit API documents, but cannot figure out how to use it. 

 

Anyone can help or give some suggestions,

Thanks.

 

Re: Revit Schedule - Title/headers

$
0
0

I know this is very old but I need an answer to this as well.

Re: Revit 2019 Tooltip ExpandedVideo does not work

$
0
0

All Revit 2019 tooltip videos are in MP4 format now.

 

See under:

"C:/Program Files/Autodesk/Revit 2019/videos/"

Re: struct or class or dictionary

$
0
0

Two ideas:  

 

1.  Revit lookup table help says this:

  • The size_lookup function is intended for instance parameters. If you want to use tabular data to define types with unique values for each type, create a type catalog

2.  Can you just put the 12.7 mm bolts in the lookup table as 127, and divide by 10 after you have found the correct column in the lookup table?

 

 

Re: struct or class or dictionary

$
0
0

Two ideas:  

 

1.  Revit lookup table help says this:

  • The size_lookup function is intended for instance parameters. If you want to use tabular data to define types with unique values for each type, create a type catalog

2.  Can you just put the 12.7 mm bolts in the lookup table as 127, and divide by 10 after you have found the correct column in the lookup table?

 

Actually, a 3rd idea also:  Are you sure you aren't using an integer number somewhere instead of a double?  Or maybe the 12.7 is getting converted to an integer?

 

Re: Get title of ViewSchedule and edit it.

$
0
0

Isn't the title always the same as the view name?

I'm not sure you can set the grid lines through the API.  Not everything that is available in the UI is available in the API.

The closest I can get is to create a view template with the grid lines turned on, and then apply the template to the view.  This is written for a C# macro, so you may need to change the uidoc and doc lines if using in a add-in.

It searches for a view name, sets it to the current view, and then displays the title (the same as the name) in a dialog box, and then sets a template.

 

 public void testviewschedule()
            {
                 UIDocument uidoc = this.ActiveUIDocument;
                Document doc = this.ActiveUIDocument.Document;
                string viewname = "DRAWING LIST";
                FilteredElementCollector collector = new FilteredElementCollector(doc);
                collector.OfClass(typeof(ViewSchedule));
                    foreach (ViewSchedule current in collector)
                                        {
                                            if (current.Name == viewname)
                                                    {
                                                    uidoc.ActiveView = current;
                                                    uidoc.RefreshActiveView();
                                                    break;
                                                    }  // end if

                                        }// end foreach ViewSection
                    TaskDialog.Show("Revit", uidoc.ActiveView.Title.ToString ());
                    
                    View viewTemplate = (from v in new FilteredElementCollector(doc).OfClass(typeof(View)).Cast<View>()
                    where v.IsTemplate == true && v.Name == "my template"
                    select v).First();

                        using (Transaction t = new Transaction(doc,"Set View Template"))
                        {
                            t.Start();           
                            doc.ActiveView.ViewTemplateId = viewTemplate.Id;
                        t.Commit();
                        }
            }// end testview schedule

 


Re: setSystemType

$
0
0

I started working on this issue again today after working on other features, and got a working workaround almost instantly. 

 

pipe.mepsystem.lookupparameter("Type").set(pipingsystemtype.id)

How to have default string value for all unmodified Shared Parameters?

$
0
0

How can I use the API's to set the default string value for a Shared Parameter (type "Text") from the current value of "" to something like "N/A"?

How detect if the space between two connectors can hold a elbow?

$
0
0

How  detect if the space between two connectors can hold a elbow?

Move BoundingBoxXYZ using Transform

$
0
0

Hi all,

I'm trying to understand Transform in Revit API. I want to move a View.Cropbox with an offset. Here is by code:

//get current View

View myView;

XYZ myOffset = new XYZ(100, 200, 0);

Transform t = Transform.CreateTranslation(myOffset);

 

//current BoundingBox

BoundingBoxXYZ curBBox = myView.CropBox;

 

//create new BoundingBox

BoundingBoxXYZ newBBox = new BoundingBoxXYZ();

newBBox.Min = curBBox.Min;

newBBox.Max = curBBox.Max;

newBBox.Transform = t;

 

//apply cropbox to view

myView.CropBox = newBBox;

myView.CropBox.Transform = newBBox.Transform;

doc.Regenerate();

 

But It doesn't change.

One another way is moving newBBox.Min and newBBox.Max but like I said on first row, I hope find the better way using Transform.

Anyone can help?

 

Thank you.

Re: Move BoundingBoxXYZ using Transform

$
0
0

Hi!

 

There is a remark in SDK about View.CropBox property:

Note: the Transform of the input BoundingBoxXYZ is ignored. Only Max and Min members of the input BoundingBoxXYZ are used.

Unfortunately, this means, that you can control only view plans crop box by setting View.CropBox property value, because for section views crop box transform is an essential part.

 

In your case you can assign

 

newBBox.Min = t.OfPoint(curBBox.Min);
newBBox.Max = t.OfPoint(curBBox.Max);

for section views it will either throw an exception (box is empty) or the result won't be valid.

 

But you can create new SectionView or change cropbox using ViewCropRegionShapeManager and far clip plane distance parameter.

 

For 3D views use another methods: GetSectionBox/SetSectionBox. I didn't try, but I am pretty sure, if you define boundingBox.Transform and pass it to SetSectionBox it all be ok.

Grafikkarte für Revit

$
0
0

hallo,

ist eine Intel UHD 620 Grafikkarte ausreichend für Revit autocard mit Intel core i5-8 CPU und ssd festplatte

Re: How to have default string value for all unmodified Shared Parameters?

$
0
0

Hi!

 

For example, like this:

var uiapp = commandData.Application;
var uidoc = uiapp.ActiveUIDocument;
var doc = uidoc.Document;

var parameterId = new Guid("<your parameter GUID>");

var sharedParameterElement = SharedParameterElement.Lookup(doc, parameterId);

var valueRule = ParameterFilterRuleFactory.CreateEqualsRule(sharedParameterElement.Id, string.Empty, false);

var parameterApplicableFilterRule = new SharedParameterApplicableRule(sharedParameterElement.Name);

var filter = new ElementParameterFilter(new [] {parameterApplicableFilterRule, valueRule});

var collector = new FilteredElementCollector(doc);

var parameters = collector
	.WherePasses(filter)
	.Select(x => x.get_Parameter(parameterId))
	.Where(x => !x.IsReadOnly);

using (var transaction = new Transaction(doc, "fill values"))
{
	transaction.Start();

	foreach (var parameter in parameters)
		parameter.Set("N/A");
	
	transaction.Commit();
}

return Result.Succeeded;

Re: How detect if the space between two connectors can hold a elbow?

$
0
0

Hi!

 

Your connectors could be at the same place and NewElbowFitting method will create an elbow if the angle between connectors is invalid.

 

Actully, you should check ducts (pipes, conduits or cable trays) length to ensure, that it will remain at the same direction. I don't know a good method to check this before creating new elbow, because elbows are user families, and they can be designed in various ways. But you can try to use Failures API to catch such situations and try to fix them

Re: How to have default string value for all unmodified Shared Parameters?

$
0
0

 I don't think that's what I'm asking for.  

 

I'm not trying to set the value of a parameter after it was created.  I'm trying to set the "default" string value of any shared parameter of that type.

 

For example, if I run my Shared Parameter script, it will install a shared parameter on all "Doors."  Let call this parameter: "TestingParm"

 

I know how to set the value (in the API's) of this parameter to be something like "Executed."

 

However, if a new user adds a new door, the shared parameter is on that family.  Since the user didn't run my script, the value is set to "".  

 

I want any new element that has my script-created shared parameter on it to default to "N/A".   If they run my script in the future, it will change the default and set the parameter to "Executed."

 

Get what I'm saying?  

Re: How to have default string value for all unmodified Shared Parameters?

Re: Get title of ViewSchedule and edit it.

$
0
0

hi, 

You may refer to code snippet below to access and update viewschedule tile(which is the hear section):

			ViewSchedule vs = this.Document.ActiveView as ViewSchedule;
			if(null == vs)
				throw new ArgumentException("The active view is not a view schedule!");
			//
			// get header section
			Transaction tran = new Transaction(this.Document, "Update Header");
			tran.Start();
			TableData td = vs.GetTableData(); // get viewschedule table data
			TableSectionData tsd = td.GetSectionData(SectionType.Header); // get header section data
			string text = tsd.GetCellText(0, 0);
			tsd.SetCellText(0, 0, "my new title");
			//
			// insert columns
			tsd.InsertColumn(0);
			tran.Commit();

Re: How to access a Railing's slope options through API?

$
0
0

hi, 

I saw RailingSlopeOption in Revit API assembly, however I didn't find any API using it.

I'm communicating with engineering team on this, will keep you updated on any progress. 

 

Viewing all 66902 articles
Browse latest View live


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