Пример #1
0
 protected override async Task BeforeExecutionAsync(IExecutionContext context)
 {
     if (_gitHub == null)
     {
         _gitHub = context.GetRequiredService <GitHubManager>();
     }
     if (_foundation == null)
     {
         _foundation = context.GetRequiredService <FoundationManager>();
         await _foundation.PopulateAsync(context);
     }
 }
        protected override async Task BeforeExecutionAsync(IExecutionContext context)
        {
            // Don't get data if we're just validating
            if (context.Settings.GetBool(SiteKeys.Validate))
            {
                return;
            }

            if (_gitHub == null)
            {
                _gitHub = context.GetRequiredService <GitHubManager>();
            }
            if (_foundation == null)
            {
                _foundation = context.GetRequiredService <FoundationManager>();
                await _foundation.PopulateAsync(context);
            }
        }
Пример #3
0
        public static void NewFoundationLine()
        {
            Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;

            using (Transaction acTrans = acDoc.Database.TransactionManager.StartTransaction())
            {
                PromptSelectionResult acSSPrompt = acDoc.Editor.GetSelection();

                // If the prompt status is OK, objects were selected
                if (acSSPrompt.Status == PromptStatus.OK)
                {
                    SelectionSet      acSSet  = acSSPrompt.Value;
                    FoundationManager manager = DataService.Current.GetStore <StructureDocumentStore>(acDoc.Name)
                                                .GetManager <FoundationManager>();

                    // Step through the objects in the selection set
                    foreach (SelectedObject acSSObj in acSSet)
                    {
                        // Check to make sure a valid SelectedObject object was returned
                        if (acSSObj != null)
                        {
                            // Open the selected object for write
                            Entity acEnt = acTrans.GetObject(acSSObj.ObjectId, OpenMode.ForRead) as Entity;

                            if (acEnt is Curve)
                            {
                                FoundationCentreline foundationCentreline = new FoundationCentreline();
                                foundationCentreline.BaseObject = acEnt.ObjectId;
                                manager.Add(foundationCentreline);
                            }
                        }
                    }

                    manager.UpdateDirty();
                }
            }
        }