Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Change length of rebar type '77'

3 REPLIES 3
Reply
Message 1 of 4
sizy458
384 Views, 3 Replies

Change length of rebar type '77'

Hello,

I should change the length of rebar 77 ,

how do i make ?

There is source code which multiply length by 1.1 and it dont' work.

 

 

  {
                Rebar rborg = TcmPick.saisiracier(uiapp.ActiveUIDocument, "ttt2");
                Document doc = rborg.Document;

                var hostid = rborg.GetHostId();
                var elthost = doc.GetElement(hostid) as FamilyInstance;

                Curve fromhost = null;

                XYZ p1pot = XYZ.Zero;
                var lc = elthost.Location;
                if (lc is LocationCurve)
                {
                    var clcc = lc as LocationCurve;
                    var ccc = clcc.Curve;
                    p1pot = ccc.GetEndPoint(0);
                    fromhost = clcc.Curve;
                }
                if (lc is LocationPoint)
                {
                    var lcp = lc as LocationPoint;
                    p1pot = lcp.Point;
                }
                //var p1 = lc.Point;
                double dx = Tcmconversionunity.smminpied(450);
                double dy = Tcmconversionunity.smminpied(600);
                //double dy
                //p1 = new XYZ(p1.X - dx, p1.Y - dy, p1.Z);

                Transaction trans;
                trans = new Transaction(doc);
                trans.Start("setheight");

                RebarShapeDrivenAccessor da = rborg.GetShapeDrivenAccessor();
                Line l1 = da.GetDistributionPath();

                var lcc = da.ComputeDrivingCurves();
                XYZ sanormal = l1.Direction;//l1.GetEndPoint(1);//
                XYZ pn1 = l1.GetEndPoint(1);
                Curve cc = lcc[0];
                XYZ p1cc = cc.GetEndPoint(0);
                XYZ p2cc = cc.GetEndPoint(1);

                Arc aa = cc as Arc;

                XYZ p1c = aa.Center;


                

                XYZ sanormalarc = aa.Normal;
                XYZ sanormalarctrafiquer = sanormalarc;
               

                XYZ sanormalarcperpendiculaire = -1 * sanormalarctrafiquer.CrossProduct(new XYZ(0, 1, 0)); //s3

                Plane parc = Plane.CreateByNormalAndOrigin(sanormalarctrafiquer, XYZ.Zero);
                Plane pldbg = Plane.CreateByNormalAndOrigin(sanormalarcperpendiculaire, XYZ.Zero);
                Transform ftdbg = Transform.CreateReflection(pldbg);
                XYZ p1b9cdbg = XYZ.Zero;


                p1b9cdbg = ftdbg.OfPoint(new XYZ(0 - aa.Radius, 0 - aa.Radius, 0)); //S3

             

                p1b9cdbg = p1b9cdbg.Add(p1c);
                XYZ p1b9c = p1b9cdbg;



                double coefmultz = sanormal.Z >= 0 ? -1 : +1;

               

                da.ScaleToBoxFor3D(p1b9c, mvect(parc.XVec, aa.Radius * 2), mvect(parc.YVec, aa.Radius * 2), da.Height *1.1* 1.0 * coefmultz); //S2



                trans.Commit();
                trans = trans;
                return Result.Succeeded;
            }

Thank.

Tags (4)
3 REPLIES 3
Message 2 of 4
jeremytammik
in reply to: sizy458

Dear Sizy,

 

Sorry, that nobody has been able to help you so far. I don't know either, so I passed on your query to the Revit Structural development team. 

 

Best regards,

 

Jeremy

 



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

Message 3 of 4
jeremytammik
in reply to: sizy458

Your question is confusing.

 

What do you mean by 'length'?

 

You code multiplies the height by 1.1.

 

Please provide a minimal reproducible case for deeper analysis, including some screen snapshots illustrating the issue:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

We checked the ScaleToBoxFor3D function and it works correctly.

 
There are parts of your code that do not compile; “mvect” is an undefined function; two variables (double dx and dy) are not used. They are calculated using Tcmconversionunity.smminpied() which is another undefined function.

 

Thank you.

 

Best regards,

 

Jeremy

 



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

Message 4 of 4
sizy458
in reply to: jeremytammik

internal static XYZ mvect(XYZ p,double Radius)
        {
            return new XYZ(p.X * Radius, p.Y * Radius, p.Z * Radius);
        }

 internal static double smminpied(double val)
        {
            double v = val / 1000.0;
            v = Sminpied(v);
            return v;
        }


        internal static double Sminpied(double p)
        {
            return p / 0.3048;
        }

Please forget variable dx,dy

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report