本文整理汇总了C#中SchemaBuilder.SetDocumentation方法的典型用法代码示例。如果您正苦于以下问题:C# SchemaBuilder.SetDocumentation方法的具体用法?C# SchemaBuilder.SetDocumentation怎么用?C# SchemaBuilder.SetDocumentation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SchemaBuilder
的用法示例。
在下文中一共展示了SchemaBuilder.SetDocumentation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateInitialParameters
// Setup routine: updates parameters of the window to the appropriate values on load
internal void UpdateInitialParameters(Document doc)
{
Transaction t = new Transaction(doc, "Update parameters");
t.Start();
SchemaBuilder builder = new SchemaBuilder(m_schemaId); //(new Guid("{4DE4BE80-0857-4785-A7DF-8A8918851CB2}"));
builder.AddSimpleField("Position", typeof(XYZ)).SetUnitType(UnitType.UT_Length);
builder.AddSimpleField("Orientation", typeof(XYZ)).SetUnitType(UnitType.UT_Length);
builder.SetSchemaName("WallPositionData");
builder.SetDocumentation("Two points in a Window element that assist in placing a section view.");
builder.SetVendorId("adsk");
builder.SetApplicationGUID(doc.Application.ActiveAddInId.GetGUID());
m_schema = builder.Finish();
t.Commit();
t.Start();
Field fieldPosition = m_schema.GetField("Position");
Field fieldOrientation = m_schema.GetField("Orientation");
FamilyInstance window = doc.get_Element(m_windowId) as FamilyInstance;
Entity storageEntity = new Entity(m_schema);
LocationPoint lp = window.Location as LocationPoint;
XYZ location = lp.Point;
storageEntity.Set<XYZ>(fieldPosition, location, DisplayUnitType.DUT_FEET_FRACTIONAL_INCHES);
XYZ orientation = window.FacingOrientation;
storageEntity.Set<XYZ>(fieldOrientation, orientation, DisplayUnitType.DUT_FEET_FRACTIONAL_INCHES);
window.SetEntity(storageEntity);
t.Commit();
}
示例2: Execute
public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
UIDocument uiDoc = commandData.Application.ActiveUIDocument;
Document doc = uiDoc.Document;
// Create transaction for working with schema
Transaction trans = new Transaction(doc, "Extensible Storage");
trans.Start();
// Select a wall element
Wall wall = null;
try
{
Reference r = uiDoc.Selection.PickObject(ObjectType.Element,
new WallSelectionFilter());
wall = doc.GetElement(r) as Wall;
}
catch (Autodesk.Revit.Exceptions.OperationCanceledException)
{
message = "Nothing selected; please select a wall to attach extensible data to.";
return Result.Failed;
}
Debug.Assert(null != wall, "expected a wall to be selected");
if (null == wall)
{
message = "Please select a wall to attach extensible data to.";
return Result.Failed;
}
// Create a schema builder
SchemaBuilder builder = new SchemaBuilder(_guid);
// Set read and write access levels
builder.SetReadAccessLevel(AccessLevel.Public);
builder.SetWriteAccessLevel(AccessLevel.Public);
// Note: if this was set as vendor or application access,
// we would have been additionally required to use SetVendorId
// Set name to this schema builder
builder.SetSchemaName("WallSocketLocation");
builder.SetDocumentation("Data store for socket related info in a wall");
// Create field1
FieldBuilder fieldBuilder1 =
builder.AddSimpleField("SocketLocation", typeof(XYZ));
// Set unit type
fieldBuilder1.SetUnitType(UnitType.UT_Length);
// Add documentation (optional)
// Create field2
FieldBuilder fieldBuilder2 =
builder.AddSimpleField("SocketNumber", typeof(string));
//fieldBuilder2.SetUnitType(UnitType.UT_Custom);
// Register the schema object
Schema schema = builder.Finish();
// Create an entity (object) for this schema (class)
Entity ent = new Entity(schema);
Field socketLocation = schema.GetField("SocketLocation");
ent.Set<XYZ>(socketLocation, new XYZ(2, 0, 0), DisplayUnitType.DUT_METERS);
Field socketNumber = schema.GetField("SocketNumber");
ent.Set<string>(socketNumber, "200");
wall.SetEntity(ent);
// Now create another entity (object) for this schema (class)
Entity ent2 = new Entity(schema);
Field socketNumber1 = schema.GetField("SocketNumber");
ent2.Set<String>(socketNumber1, "400");
wall.SetEntity(ent2);
// Note: this will replace the previous entity on the wall
// List all schemas in the document
string s = string.Empty;
//.........这里部分代码省略.........
示例3: GetStorageSchema
private Schema GetStorageSchema()
{
var bld = new SchemaBuilder(_schemaGuid);
bld.SetSchemaName("BimLibraryData");
bld.SetWriteAccessLevel(AccessLevel.Public);
bld.SetReadAccessLevel(AccessLevel.Public);
//bld.SetVendorId("ADSK");
bld.SetDocumentation("This schema stores project specific application data of Czech BIM Library.");
bld.AddSimpleField(FieldNameData, typeof(String)).SetDocumentation("Data field");
return bld.Finish();
}