Results 1 to 2 of 2

Thread: I have difficulties in handling API AutoCAD.Net using Dynamic Blocks

  1. #1
    Member
    Join Date
    2012-07
    Posts
    5
    Login to Give a bone
    0

    Question I have difficulties in handling API AutoCAD.Net using Dynamic Blocks

    Please, I have difficulties in handling API AutoCAD.Net using Dynamic Blocks. Could you help me?
    Thanks in advance.

    I'm trying to modify the configuration of a given dynamic block.
    The goal is to access the property Table1 Block Dynamic Block and change its value to an existing one.

    You can navigate between the records from Table1 Block?
    With this code below I have managed to navigate between the dynamic properties of the block and its values​​, but I can not make the property value set in the block table1.

    I tried an example of the link: http://through-the-interface.typepad...blocks/page/3/
    however it still fails.

    If you have something that can help me I would be very grateful! Attached is a file with dynamic block if you can help me ...

    [CommandMethod("getprop")]
    static public void GetProps()
    {
    Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor;
    PromptEntityOptions peo = new PromptEntityOptions("\nSelecione o Bloco: ");
    peo.SetRejectMessage("\nIsso não é um Bloco."); peo.AddAllowedClass(typeof(BlockReference), false);
    PromptEntityResult per = ed.GetEntity(peo); if (per.Status != PromptStatus.OK) return; ObjectId sourceId = per.ObjectId;
    using (Transaction tr = db.TransactionManager.StartTransaction())
    {
    BlockReference brF = (BlockReference)tr.GetObject(sourceId, OpenMode.ForRead);
    if (brF != null && brF.IsDynamicBlock) foreach (DynamicBlockReferenceProperty prop in brF.DynamicBlockReferencePropertyCollection)
    ed.WriteMessage(string.Format("\n{0}: {1}: ", prop.PropertyName, prop.Value)); tr.Commit();
    }
    }
    }




    Thank you!
    Attached Files Attached Files

  2. #2
    Member
    Join Date
    2012-07
    Posts
    5
    Login to Give a bone
    0

    Exclamation Re: I have difficulties in handling API AutoCAD.Net using Dynamic Blocks

    See this example that I found in LISP program. the program does exactly what I need, but I would like do in C##.NET program.
    ;(GetBlockValue "Block Table1" 2) (defun GetBlockValue (prop value) (vl-load-com) (setq block (entlast)) (vl-some (function (lambda ( _prop ) (if (eq prop (strcase (vla-get-propertyname _prop))) (progn (vla-put-value _prop (vlax-make-variant value (vlax-variant-type (vla-get-value _prop)))) value ) ) ) ) (vlax-invoke (vlax-ename->vla-object Block) 'GetDynamicBlockProperties)) )

Similar Threads

  1. GD12-3: Go Dynamic: How to Create Dynamic Blocks in AutoCAD 2006
    By Autodesk University in forum General Design
    Replies: 0
    Last Post: 2013-04-17, 04:17 AM
  2. Dynamic Blocks in AutoCAD Map
    By nightNday in forum Dynamic Blocks - Technical
    Replies: 0
    Last Post: 2008-07-25, 05:58 PM
  3. How are people handling the scale of callout tags with Dynamic Blocks
    By mboyer in forum Dynamic Blocks - Technical
    Replies: 8
    Last Post: 2006-10-24, 10:22 PM
  4. Revit and AutoCAD dynamic Blocks
    By mjohnson.88569 in forum Revit Architecture - General
    Replies: 1
    Last Post: 2006-05-05, 01:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •