Esempio n. 1
0
        PublishSheetProperties(Autodesk.AutoCAD.Publishing.PublishSheetEventArgs e)
        {
            AcPb.EPlotProperty   prop;
            AcPb.EPlotProperty[] propArray = new AcPb.EPlotProperty[4];

            //Get the linear units
            //
            prop         = new AcPb.EPlotProperty();
            prop.Name    = "_UnitLinear";
            prop.Value   = "inch";
            propArray[0] = prop;

            //Get the angular units
            //
            prop         = new AcPb.EPlotProperty();
            prop.Name    = "_UnitAngular";
            prop.Value   = "radian";
            propArray[1] = prop;

            //Get the area units.
            //
            prop         = new AcPb.EPlotProperty();
            prop.Name    = "_UnitArea";
            prop.Value   = "square_foot";
            propArray[2] = prop;

            //Get the volume units
            //
            prop         = new AcPb.EPlotProperty();
            prop.Name    = "_UnitVolume";
            prop.Value   = "cubic_foot";
            propArray[3] = prop;

            e.AddPagePropertyRange(propArray);
        }
Esempio n. 2
0
        PublishEntityProperties(Autodesk.AutoCAD.Publishing.PublishEntityEventArgs e)
        {
            Int32 curNodeId = -1;

            AcDb.ObjectIdCollection refPathIds;

            refPathIds = e.getEntityBlockRefPath();
            curNodeId  = e.GetEntityNode(e.Entity.ObjectId, refPathIds);

            AcPb.EPlotPropertyBag propBag = new AcPb.EPlotPropertyBag();
            AcPb.EPlotProperty    prop;
            AcPb.EPlotAttribute   attrib;

            //Add the property
            //
            prop          = new AcPb.EPlotProperty();
            prop.Name     = "Cast Shadows";
            prop.Category = "Entity Properties";
            prop.Value    = e.Entity.CastShadows.ToString();

            //Add the hidden attribute data to the property
            //
            attrib       = new AcPb.EPlotAttribute();
            attrib.Ns    = "MgdDbg";
            attrib.NsUrl = "http://adsk/MgdDbg.xsd";
            attrib.Name  = "value";
            attrib.Value = System.Convert.ToInt32(e.Entity.CastShadows).ToString();

            prop.Attributes.Add(attrib);
            propBag.Properties.Add(prop);

            //Add the property
            //
            prop          = new AcPb.EPlotProperty();
            prop.Name     = "Clone Me For Dragging";
            prop.Category = "Entity Properties";
            prop.Value    = e.Entity.CloneMeForDragging.ToString();

            //Add the hidden attribute data to the property
            //
            attrib       = new AcPb.EPlotAttribute();
            attrib.Ns    = "MgdDbg";
            attrib.NsUrl = "http://adsk/MgdDbg.xsd";
            attrib.Name  = "value";
            attrib.Value = System.Convert.ToInt32(e.Entity.CloneMeForDragging).ToString();

            prop.Attributes.Add(attrib);
            propBag.Properties.Add(prop);

            //Add the property
            //
            prop          = new AcPb.EPlotProperty();
            prop.Name     = "Collision Type";
            prop.Category = "Entity Properties";
            prop.Value    = e.Entity.CollisionType.ToString();

            //Add the hidden attribute data to the property
            //
            attrib       = new AcPb.EPlotAttribute();
            attrib.Ns    = "MgdDbg";
            attrib.NsUrl = "http://adsk/MgdDbg.xsd";
            attrib.Name  = "value";
            attrib.Value = System.Convert.ToInt32(e.Entity.CollisionType).ToString();

            prop.Attributes.Add(attrib);
            propBag.Properties.Add(prop);

            //Add the property
            //
            prop          = new AcPb.EPlotProperty();
            prop.Name     = "Color";
            prop.Category = "Entity Properties";
            prop.Value    = e.Entity.Color.ColorNameForDisplay;

            //Add the hidden attribute data to the property
            //
            attrib       = new AcPb.EPlotAttribute();
            attrib.Ns    = "MgdDbg";
            attrib.NsUrl = "http://adsk/MgdDbg.xsd";
            attrib.Name  = "value";
            attrib.Value = e.Entity.ColorIndex.ToString();

            prop.Attributes.Add(attrib);
            propBag.Properties.Add(prop);

            //Now that all the properties have been setup, associate them with the node
            //
            AcPb.DwfNode dwfNode = null;

            if (curNodeId == -1)
            {
                curNodeId = e.GetNextAvailableNode();
                dwfNode   = new AcPb.DwfNode(curNodeId, "MgdDbg");

                e.AddNodeToMap(e.Entity.ObjectId, refPathIds, curNodeId);
            }
            else
            {
                dwfNode = e.GetNode(curNodeId);
            }

            propBag.Id = "MGDDBG-" + e.UniqueEntityId;
            propBag.References.Add(propBag.Id);

            e.AddPropertyBag(propBag);
            e.AddPropertiesIds(propBag, dwfNode);
        }