VBA : placing fence

Hi all,

To get more efficient job, i'll try to place fence for printing within automated VBA code.

So the idea is to get ID of rectangulare element, or coord of it's extrem points, and place fence upon it.

macro will do the rest of job, parametring and printing.

 

But i don't know how to place fence with Element ID or even it's possible !

 

Do someone know something about that ?

 

 

PS : My job requires me to use only the default model, even when my draw is on many pages ....

Parents
  • I would say you have multiple questions here:

    How to get an Element from Element ID?
    I guess I would ask first, how are you getting the Element ID and why?
    To get the Element ID, do you not already have an Element reference?
    I don't think using a static Element ID sounds like a good idea, especially with no idea of your intended implementation.
    However, the answer would be to use the ModelReference.GetElementByID(ElementID as DLong) method.

    You could explicitly create a fence using the extracted points from a Shape Element, but you could also create a fence directly from the Shape.
    Take a look at the Fence.DefineFromElement (View, ClosedElement) method.

    To define the fence from extracted points, you could use the Fence.DefineFromModelPoints (View, Perimeter() as Point3d) method.

    A bigger concern might be the actual printing. I would consider reliably printing to be a more difficult task in VBA than defining the fence.

    Hope this helps,
    -G-

Reply
  • I would say you have multiple questions here:

    How to get an Element from Element ID?
    I guess I would ask first, how are you getting the Element ID and why?
    To get the Element ID, do you not already have an Element reference?
    I don't think using a static Element ID sounds like a good idea, especially with no idea of your intended implementation.
    However, the answer would be to use the ModelReference.GetElementByID(ElementID as DLong) method.

    You could explicitly create a fence using the extracted points from a Shape Element, but you could also create a fence directly from the Shape.
    Take a look at the Fence.DefineFromElement (View, ClosedElement) method.

    To define the fence from extracted points, you could use the Fence.DefineFromModelPoints (View, Perimeter() as Point3d) method.

    A bigger concern might be the actual printing. I would consider reliably printing to be a more difficult task in VBA than defining the fence.

    Hope this helps,
    -G-

Children
No Data