예제 #1
0
 /// <summary>
 /// after creation, need to regen doc to get
 /// corrent orientation info.
 /// </summary>
 public override void PostProcess()
 {
     if (this.NewFI != null && this.NewFI.IsValidObject)
     {
         FamilyEditor.SetOrientation(this.NewFI, this.Hand, this.Facing);
         this.OperationFinished = true;
     }
 }
예제 #2
0
        /// <summary>
        /// need OPEN TRANSACTION
        /// </summary>
        public override void Execute()
        {
            var doc = this.fs.Document;

            if (this.hostFace != null &&
                this.hostFace.Reference != null)
            {
                this.referenceString = this.hostFace.Reference.ConvertToStableRepresentation(doc);
            }
            //project offset line onto host face
            if (this.hostFaceRef == null && this.hostFace == null)
            {
                ThrowHostNotFound();
            }
            var locLine = getLocLine();

            if (this.hostFaceRef != null)
            {
                base.Elem = doc.Create.NewFamilyInstance(this.hostFaceRef, locLine, this.fs);
            }
            else if (this.referenceString != null)
            {
                var hostFaceRef = Reference.ParseFromStableRepresentation(doc, this.referenceString);
                base.Elem = doc.Create.NewFamilyInstance(hostFaceRef, locLine, this.fs);
            }
            else if (this.hostFace != null)
            {
                try
                {
                    base.Elem = doc.Create.NewFamilyInstance(this.hostFace, locLine, this.fs);
                }
                catch (Autodesk.Revit.Exceptions.ArgumentsInconsistentException ex)
                {
                    FamilyCreator.HostsWithInstanceFaceProblem.Add(this.Host);
                }
                catch (Autodesk.Revit.Exceptions.InvalidOperationException ex)
                {
                    FamilyCreator.HostsWithInstanceFaceProblem.Add(this.Host);
                }
            }

            if (this.NewFI == null)
            {
                return;
            }
            FamilyEditor.SetParams(this.NewFI, this.paramValues);
            //offset from host
            calcOffset();
        }
예제 #3
0
        public override void Execute()
        {
            var doc = this.fs.Document;

            if (this.hostWall != null)
            {
                var level = doc.GetElement(this.hostWall.LevelId) as Level;
                base.Elem = doc.Create.NewFamilyInstance(this.pos, this.fs, this.hostWall, level, this.sType);
                FamilyEditor.SetParams(this.NewFI, this.paramValues);
            }
            else
            {
                ThrowHostNotFound();
            }
        }
예제 #4
0
 /// <summary>
 /// after creation, need to regen doc to get
 /// corrent orientation info.
 /// </summary>
 public override void PostProcess()
 {
     if (this.NewFI != null && this.NewFI.IsValidObject)
     {
         if (facingRefPoint != null)
         {
             adjustFacingByRefPoint(this.NewFI);
         }
         FamilyEditor.SetOrientation(this.NewFI, this.Hand, this.Facing);
         //cuts needs to be inside post process
         //otherwise face change might affect creation of other new instances.
         HostUtils.CutUncutHost(this.NewFI, this.CutsHost);
         base.CutAndJoin();
         this.OperationFinished = true;
     }
 }
예제 #5
0
        /// <summary>
        /// after creation, need to regen doc to get
        /// corrent orientation info.
        /// </summary>
        public override void PostProcess()
        {
            var doc = this.fs.Document;

            //delete temp views
            //delete here in case other creators use the same view
            if (this.tempViewPlan && this.viewPlan.IsValidObject)
            {
                doc.Delete(this.viewPlan.Id);
            }
            if (this.NewFI != null && this.NewFI.IsValidObject)
            {
                FamilyEditor.SetOrientation(this.NewFI, this.Hand, this.Facing);
                this.OperationFinished = true;
            }
        }
예제 #6
0
        /// <summary>
        /// need OPEN TRANSACTION
        /// </summary>
        public override void Execute()
        {
            var doc = this.fs.Document;

            if (this.sType != StructuralType.Footing)
            {
                //create new on level
                var locLine = getLocLine();
                base.Elem = doc.Create.NewFamilyInstance(locLine, this.fs, this.hostLevel, this.sType);
            }
            else
            {
                //find face on temp geom
                PlanarFace pf = this.tempDS.GetAllSolids()
                                .SelectMany(s => s.Faces.Cast <PlanarFace>())
                                .Where(f => f != null)
                                .FirstOrDefault(f => f.FaceNormal.IsAlmostEqualToByDifference(XYZ.BasisZ, 0.0001));

                var tempFi = doc.Create.NewFamilyInstance(pf, this.offsetLocLine, fs);
                //copy to level
                var cpo       = new CopyPasteOptions();
                var newCopies = ElementTransformUtils.CopyElements
                                    (this.viewPlan,
                                    new ElementId[1] {
                    tempFi.Id
                },
                                    this.viewPlan, null, cpo);
                base.Elem = doc.GetElement(newCopies.First()) as FamilyInstance;
                //delete temp elems
                doc.Delete(tempFi.Id);
                if (this.tempDS != null)
                {
                    doc.Delete(this.tempDS.Id);
                }
            }

            if (this.NewFI == null)
            {
                return;
            }
            FamilyEditor.SetParams(this.NewFI, this.paramValues);

            calcOffset();
        }
예제 #7
0
        /// <summary>
        /// need OPEN TRANSACTION
        /// </summary>
        public override void Execute()
        {
            var doc = this.fs.Document;

            if (this.HostFaceRef != null)
            {
                base.Elem = doc.Create.NewFamilyInstance(this.HostFaceRef, this.Pos, this.Hand, this.fs);
            }
            else if (this.HostFace != null)
            {
                base.Elem = doc.Create.NewFamilyInstance(this.HostFace, this.Pos, this.Hand, this.fs);
            }
            else
            {
                ThrowHostNotFound();
            }
            if (this.flipFacing)
            {
                this.NewFI.flipFacing();
            }
            FamilyEditor.SetParams(NewFI, this.paramValues);
        }