[urgent] How clone wall with curve locked

[urgent] How clone wall with curve locked

sizy458
Advocate Advocate
522 Views
3 Replies
Message 1 of 4

[urgent] How clone wall with curve locked

sizy458
Advocate
Advocate

Hello,

In revit , When i clone a wall ,it work good.

But this code i observe.

if (true)
                                {
                                    var lc = wallClone.Location as LocationCurve;
                                    //debug
                                    XYZ l1 = lc.Curve.GetEndPoint(0);
                                    XYZ l2 = lc.Curve.GetEndPoint(1);
                                    l1 = null;

                                }
                                doc.Regenerate();
                                if (true)
                                {
                                    var lc = wallClone.Location as LocationCurve;
                                    //debug
                                    XYZ l3 = lc.Curve.GetEndPoint(0);
                                    XYZ l4 = lc.Curve.GetEndPoint(1);
                                    l3 = null;

                                }

THEN ,

i observe that l1 different from l3 and l2 different from l4.

Why ?

 

How lock the curve wall for avoiding regenerate ?

 

Thank.

0 Likes
523 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk

I do not understand your question at all, I'm sorry to say.

 

However, just guessing, I would assume that you wish to perform two steps:

 

  • Clone a wall
  • Modify the cloned wall's location curve

 

I imagine that might be achievable as follows:

 

  Wall wall_clone = clone the wall...
  // create any kind of curve you like:
  Curve new_wall_curve = Line.CreateBound... 
  wall_clone.Location = new_wall_curve;

 

I hope this helps.

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 4

sizy458
Advocate
Advocate

I want cloned exactly a wall

 LocationCurve locCurve = wallSource.Location as LocationCurve;
Curve cc1 = locCurve.Curve;
 wallClone = Wall.Create(doc, cc1, lvdest.Id, true);


                                {
                                    var lc = wallClone.Location as LocationCurve;
                                    //debug
                                    XYZ l1 = lc.Curve.GetEndPoint(0);
                                    XYZ l2 = lc.Curve.GetEndPoint(1);
                                    l1 = null;

                                
                                
                                doc.Regenerate();
                                
                                
                                    var lc = wallClone.Location as LocationCurve;
                                    //debug
                                    XYZ l3 = lc.Curve.GetEndPoint(0);
                                    XYZ l4 = lc.Curve.GetEndPoint(1);
                                    l3 = null;

                                }

Then in certain cases 'l1 'is not equal 'l3' and 'l2' is not equal 'l4'.

Why ?

0 Likes
Message 4 of 4

jeremytammik
Autodesk
Autodesk

Revit implements a BIM.

 

BIM is a realistic building model.

 

In reality, you cannot have two walls in exactly the same place.

 

Therefore, Revit prevents you from having that in the BIM as well.

 

Please always test whatever you are trying to do manually in the user interface before even thinking about addressing it programmatically.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes