Hi, I create a macro that create wall from base Column in Revit Link (Column belong to revit link). But all created wall only in the same position. Please help me, thanks.
Here my code:
Code:
ElementId wallId = Supports.GetElementIdOfWallType(Initiazation.indexOfWallColumn,doc);
			ElementId levelId = Supports.GetElementIdOfLevelType(Initiazation.indexOfLevelColumn,doc);
			
			double offset = 0;
			double  _heightCol = 0;
			
				
				FilteredElementCollector filter = new FilteredElementCollector(doc)
					.OfCategory(BuiltInCategory.OST_RvtLinks);
	
				IList<Element> elements = filter.ToElements();
				
				//string names="";
				
				foreach (Document d in docs) {
					if(d.IsLinked){
						
						//Select all beam in revit link
						FilteredElementCollector beams = new FilteredElementCollector(d)
							.OfCategory(BuiltInCategory.OST_StructuralColumns)
							.WhereElementIsNotElementType();
						
						//TaskDialog.Show("test",beams.ToElements().Count+"");
						
						//Retrieve every beam in revit links
						foreach (Element beam in beams) {
							_heightCol = Supports.GetLengthColumn(beam,d);				
								IList<Solid> solids = Supports.GetSolidFromElement(beam,new Options());
								//names+= solid.ToString() + Environment.NewLine;
								foreach (Solid solid in solids) {
									if (null!=solid && solid.Volume!=0) {
									//names+= solid.Volume + Environment.NewLine;
									foreach (Face face in solid.Faces) {
										//names+= "face khong null" + Environment.NewLine;
										PlanarFace planarFace = face as PlanarFace;
										if (planarFace!=null) {
											
											if (planarFace.Normal.Z == -1) {
	
												EdgeArrayArray edgeArrays = face.EdgeLoops;
												
												foreach (EdgeArray edges in edgeArrays)
							                    {		
													Curve[] curves = {edges.get_Item(Provider.INDEX_OF_EDGE_COLUMN_0).AsCurve(),
														edges.get_Item(Provider.INDEX_OF_EDGE_COLUMN_1).AsCurve(),
														edges.get_Item(Provider.INDEX_OF_EDGE_COLUMN_2).AsCurve(),
														edges.get_Item(Provider.INDEX_OF_EDGE_COLUMN_3).AsCurve()};
													
													using (Transaction t = new Transaction(doc,"trát cột")) {
				
														t.Start();
														
															for (int i = 0; i < curves.Count(); i++) {
																Wall.Create(doc,
																        curves[i],
															            wallId,
															            levelId,
															            _heightCol,
															            offset,
															            Initiazation.isFlipWall,
															            Initiazation.isStructure);
															}
														t.Commit();
													}													
							                    }
	
												
											}
										}
									}//for
								}
						}
						
										
					}
				}
				
				//TaskDialog.Show("alert",names+"");
			}
And my function to get solid:
Code:
public static IList<Solid> GetSolidFromElement(Element _element, Options _option){
			IList<Solid> solid = new List<Solid>();
			GeometryElement geoElem = _element.get_Geometry(_option);
			if(geoElem!=null){
				foreach (GeometryObject geoOb in geoElem) {
					Solid sol = geoOb as Solid;
					if (null!=sol) {
						solid.Add(sol);
					}else if (geoOb is GeometryInstance) {
						GeometryInstance geoInst = geoOb as GeometryInstance;
						GeometryElement geoE = geoInst.SymbolGeometry;
						Transform transform = geoInst.Transform;
						if (geoE!=null) {
							foreach (GeometryObject o in geoE) {
								Solid sol1 = o as Solid;
								if (null!=sol1) {
									solid.Add(sol1);
								}
							}
						}
					}
				}
			}
			
			return solid;
		}