Placing elements on wall

Placing elements on wall

Anonymous
Not applicable
816 Views
7 Replies
Message 1 of 8

Placing elements on wall

Anonymous
Not applicable

Hi,

 

Struggling to place an element on wall[second floor level] like switch , mirror light etc.

 

Tried several combinations of NewFamilyInstance but nothing led to place elements on wall. They seems to be fall very below the second floor level.

 

 

Thanks & Regards

Sanjay Pandey

0 Likes
817 Views
7 Replies
Replies (7)
Message 2 of 8

Aaron.Lu
Autodesk
Autodesk
Dear, would you please attach the family file, so that I can try from my side?


Aaron Lu
Developer Technical Services
Autodesk Developer Network
0 Likes
Message 3 of 8

Anonymous
Not applicable

Yes sure.

 

Please Find Attached.

0 Likes
Message 4 of 8

Aaron.Lu
Autodesk
Autodesk

try these 2 methods:

 

  • FamilyInstance NewFamilyInstance(Reference reference, XYZ location, XYZ referenceDirection, FamilySymbol symbol)
  • FamilyInstance NewFamilyInstance(Reference reference, Line position, FamilySymbol symbol)

 

for example:

Wall wall = null;
var references = HostObjectUtils.GetSideFaces(wall, ShellLayerType.Interior);
var reference = references.First();
RevitDoc.Create.NewFamilyInstance(reference, new XYZ(0, 0, 0), new XYZ(0, 0, 1), familySymbol);


Aaron Lu
Developer Technical Services
Autodesk Developer Network
0 Likes
Message 5 of 8

Anonymous
Not applicable

Still the same result.

0 Likes
Message 6 of 8

Anonymous
Not applicable

Hi,

 

When I am trying to use this method

 

doc.Create.NewFamilyInstance(face, location, xrefdir, symbol);

 

the attached family Mirror Light fixture gets placed at the bottom of the wall and also its elevation property is disabled but when I manually place that family on the wall it fits correctly and and also elevtion property is enabled. and When I place the attached switch family [Switch board] via the above method it places in a surprising way.

 

screenshots follows:

 

switch placed via code . Note that elevation is grayed out/disabled

 

 

viacode.png

 

 

 

switch placed manually

 

 

manually.png

 

Thanks & Regards

0 Likes
Message 7 of 8

Aaron.Lu
Autodesk
Autodesk
What about changing the parameter "Schedule Level" to a real level after creating
and then see if the parameter Elevation is editable?


Aaron Lu
Developer Technical Services
Autodesk Developer Network
0 Likes
Message 8 of 8

Anonymous
Not applicable

Tried and changed  "Schedule Level" to a real level still elevation is grayed out. but when cut and paste the instance created normally then it works perfectly fine.

 

I don;t know but it should be pretty simple

 

1. Get the face of the wall.

2. decide the fanily to palce

3. decide its location to lace

4 and then place it

 

what in the world am I doing wrong.

 

Thanks & Regards

Sanjay Pandey 

0 Likes