Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

About AddAllowedClass()

1 REPLY 1
SOLVED
Reply
Message 1 of 2
joantopo
673 Views, 1 Reply

About AddAllowedClass()

Hi.

 

I have this:

  Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView();

       Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
       Database db = doc.Database;
       Editor ed = doc.Editor;


       Autodesk.Civil.ApplicationServices.CivilDocument civilDoc = default(Autodesk.Civil.ApplicationServices.CivilDocument);
       civilDoc = Autodesk.Civil.ApplicationServices.CivilApplication.ActiveDocument; //obtener el documento de Civil

       PromptEntityOptions entOpts = new PromptEntityOptions(" Selecciona una superfície del dibujo <vuelve a la paleta>: ");

       var _with1 = entOpts;
       _with1.SetRejectMessage("no es una objeto superfície.");
       _with1.AddAllowedClass(typeof(Autodesk.Civil.DatabaseServices.TinSurface), true);
       _with1.AllowNone = true;
       _with1.AllowObjectOnLockedLayer = true;
       PromptEntityResult entRes = ed.GetEntity(entOpts);
       if (entRes.Status != PromptStatus.OK)
           return;

  using (DocumentLock docLock = doc.LockDocument()) //bloqueo
       {
           using (Transaction trans = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction())
           {

               Autodesk.Civil.DatabaseServices.Surface sup = default(Autodesk.Civil.DatabaseServices.Surface);
               sup = trans.GetObject(entRes.ObjectId, OpenMode.ForRead) as Autodesk.Civil.DatabaseServices.Surface;
               Autodesk.AutoCAD.Geometry.Point3dCollection pt3dcoll = new Point3dCollection();

//....................

 I get a surfaceID from selected  TIN surface in drawing, although I want to can also select a GRID surface.

 

How can I modify this code line to allow both classes? (TinSurface and GridSurface)

_with1.AddAllowedClass(typeof(Autodesk.Civil.DatabaseServices.TinSurface), true);

 Thank you.

 

Autocad C3D 2019 SP3, 2020 & 2021
Intel I9 9900K with frontal watercooler alphacool eisbaer 360 (original fans mounted in pull)- 3 fans Corsair 120 ML PRO in push.
MOBO Gygabyte Z390 Aorus Master- Corsair RGB Vengeance 64GB RAM (4x16) CL16
Nvidia Quadro RTX 4000
Samsung 970 EVO PLUS 1TB (unit C). Samsung 970 PRO 512GB (for data)
Power Supply: Corsair TX850M PLUS


Descubre mi programa VisorNET para Civil 3D:
https://apps.autodesk.com/CIV3D/es/Detail/Index?id=appstore.exchange.autodesk.com%3avisornet_windows32and64%3aes
1 REPLY 1
Message 2 of 2
Jeff_M
in reply to: joantopo

just add another line for that AddAllowedClass...
_with1.AddAllowedClass(typeof(Autodesk.Civil.DatabaseServices.TinSurface), true);
_with1.AddAllowedClass(typeof(Autodesk.Civil.DatabaseServices.GridSurface), true);
Jeff_M, also a frequent Swamper
EESignature

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

Post to forums  

Rail Community


Autodesk Design & Make Report