Getting the column lines

Getting the column lines

desdinova
Advocate Advocate
615 Views
1 Reply
Message 1 of 2

Getting the column lines

desdinova
Advocate
Advocate
Options opt = new Options();
            opt.ComputeReferences = true;
            opt.IncludeNonVisibleObjects = true;

            View view=doc.ActiveView;
            

            IList<Reference> myRefs =uidoc.Selection.PickObjects(ObjectType.Element);
            foreach(Reference r in myRefs)
            {
                FamilyInstance fi = doc.GetElement(r) as FamilyInstance;

                if (view != null)
                    opt.View = doc.ActiveView;

                GeometryElement ge = fi.get_Geometry(opt);
                if (ge != null)
                {
                   
                    foreach (GeometryObject go in ge)
                    {
                        if (go is GeometryInstance)
                        {

                            GeometryInstance gi = go as GeometryInstance;
                            foreach (GeometryObject goSymbol in gi.GetSymbolGeometry())
                            {

                                if(goSymbol is Line)
                                {
                                    Line line = goSymbol as Line;

                                   
                                            using (Transaction tx = new Transaction(doc))
                                            {
                                                tx.Start("Transaction Name");
                                                DetailCurve dc = doc.Create.NewDetailCurve(doc.ActiveView, line);
                                                tx.Commit();
                                            }

                                }

                            }
                        }
                    }
                }
            }

Hello friends 

i want to get lines from columns 

But when i draw the lines they are not in correct place

The code drows line in (0,0,0) 

What am i doing wrong? How can i solve this.

Thanks in advance...

 

http://www.screencast.com/t/8KYFyVyhw7N

 

0 Likes
Accepted solutions (1)
616 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk
Accepted solution

You have to take the family instance or rather the geometry instance transform into account.

 

You can look at the ElementViewer SDK sample to see one possibility of handling this.

 

Best regards,

 

Jeremy



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