• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    AutoCAD Electrical

    Reply
    Contributor
    Posts: 13
    Registered: ‎12-05-2012

    [VBA] How to generate a Point and a "etiquette"

    226 Views, 5 Replies
    12-06-2012 06:55 AM

    Hello,

     

    I would like to generate a point and an "etiquette" (I don't know the english word for that) in VBA and adding it to my block

     

    I attached a picture showing what I want this is easier :smileywink:

     

    Regards,

     

    Nicolas

    Please use plain text.
    Valued Contributor
    Nata_ly
    Posts: 76
    Registered: ‎08-21-2012

    Re: [VBA] How to generate a Point and a "etiquette"

    12-06-2012 07:30 AM in reply to: Nicolas.L

    Maybe 'notes'... I don't use english ACE too.

    But it's in 'Home' ribbon, Annotations... circle with an arrow under 'Size'.

    Is this you looking for?

    Please use plain text.
    Distinguished Mentor
    rhesusminus
    Posts: 569
    Registered: ‎09-21-2007

    Re: [VBA] How to generate a Point and a "etiquette"

    12-06-2012 11:46 AM in reply to: Nicolas.L

    Can you be more specific?

     

    To draw some lines, and add a text to it... that I can help you with in VBA. But.. adding it to the block?

    What block? Shold the lines/text be added to the block? Might make some trouble for you....

     

     


    THL
    Please select "Accept As Solution" if this post answers your question. Kudos don't hurt either. ;-)
    Please use plain text.
    Contributor
    Posts: 13
    Registered: ‎12-05-2012

    Re: [VBA] How to generate a Point and a "etiquette"

    12-07-2012 12:08 AM in reply to: rhesusminus

    Morning,

     

    Thanks for your answer so, I will try to explain my problem:

     

    I would like to have something like a connection point and a annotation referring to this point in VBA in order to be abler to generate automatically wire between this two points in VBA. If some one have example of kind of project similar I will be grateful.

     

    Nata_ly : I tried "notes" and it is not that, I think this is only for annotation.
     
    rhesusminus : In fact this is not only line I think and text I think, I am looking for an item acting like a wire connection. Don't worry about the block I give you a sample of my code:
     

    Sub Design_1()

     

    'Define the block
    Dim blockObj As AcadBlock
    Dim insertionPnt(0 To 2) As Double
    insertionPnt(0) = 0
    insertionPnt(1) = 0
    insertionPnt(2) = 0
    Set blockObj = ThisDrawing.Blocks.Add(insertionPnt, "CircleBlock")


    ' Add a circle to the block
    Dim circleObj As AcadCircle
    Dim center(0 To 2) As Double
    Dim radius As Double
    center(0) = 0
    center(1) = 0
    center(2) = 0
    radius = 1
    Set circleObj = blockObj.AddCircle(center, radius)

    Set blockObj = ThisDrawing.Blocks.Add(insertionPnt, "Polyline")

     

    ' Define the outside of the dessin_1

    Dim Point(14) As Double
    Dim poly As AcadPolyline

    Point(0) = 0: Point(1) = 0: Point(2) = 0
    Point(3) = 80: Point(4) = 0: Point(5) = 0
    Point(6) = 80: Point(7) = 60: Point(8) = 0
    Point(9) = 0: Point(10) = 60: Point(11) = 0
    Point(12) = 0: Point(13) = 0: Point(14) = 0

    Set poly = blockObj.AddPolyline(Point)

     

    ' Define the attribute definition, Cette partie permet d'ajouter un attribut au bloque   

        Dim attributeObj As AcadAttribute
        Dim insertionPnt1(0 To 2) As Double
        Dim height As Double
        Dim mode As Integer
        Dim prompt As String
        Dim tag As String
        Dim value As String
       
        height = 5
        mode = acAttributeModeNormal
        tag1 = "Part_No"
        prompt1 = "What is the Part No?"
        value1 = "172.168.0.1"
        insertionPnt1(0) = 5#: insertionPnt1(1) = 5: insertionPnt1(2) = 0
       
    ' Define the attribute definition, Cette partie permet d'ajouter un attribut au block
        'Dim acadPT As AcadPoint
        'Dim NewPoint(2) As Double
        'NewPoint(0) = 40: NewPoint(1) = 0: NewPoint(2) = 0

     

    ' Insert the block MOP
        Dim blockRefObj As AcadBlockReference
        insertionPnt(0) = 150
        insertionPnt(1) = 150
        insertionPnt(2) = 0

    ' Add The Attribut IP¨to the Block
        Set attributeObj = blockObj.AddAttribute(height, mode, prompt1, insertionPnt1, tag1, value1)
    'Ajoute le cercle au block
        Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock _
        (insertionPnt, "CircleBlock", 1#, 1#, 1#, 0)
    'Ajoute le rectangle au block
        Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock _
        (insertionPnt, "Polyline", 1#, 1#, 1#, 0)

    ZoomAll
    MsgBox "Le bloque se trouve " & blockRefObj.ObjectName

    End Sub

    Please use plain text.
    Distinguished Mentor
    rhesusminus
    Posts: 569
    Registered: ‎09-21-2007

    Re: [VBA] How to generate a Point and a "etiquette"

    12-07-2012 04:49 AM in reply to: Nicolas.L

    So... In your drawing, you want to find all blocks named "CircleBlock", and connect these somehow, with an AEWIRE ?

     


    THL
    Please select "Accept As Solution" if this post answers your question. Kudos don't hurt either. ;-)
    Please use plain text.
    Contributor
    Posts: 13
    Registered: ‎12-05-2012

    Re: [VBA] How to generate a Point and a "etiquette"

    12-09-2012 10:43 PM in reply to: rhesusminus

    Morning rhesusminus,

     

    Sorry for my late answer but yes, I think i would like to to find two circle named something like "circle_128" and "circle_3" and connect these .

    Maybe with an AEWIRE, i don't realy know the different wires, I am new on AutocadElectrical.

     

    Regards

     

    Nicolas

    Please use plain text.