What is the best way to modify a dimension that is being put in by a VBA?

I need to modify the placement of a dimension based on certain criteria. This would be just moving the text part of the dimension.

Parents
  • Modify, Element (7,1) will allow you to grab just the text from the dimension and move it. It also allows you to move the dimension line if you click on it rather than the text.

    I'm not clear if you are trying to move the text after it was put in by VBA or trying to use VBA to move it. I've not tried moving the text of a dimension via VBA but I believe it would be straightforward. The difficult part would be the "based on certain criteria". I'm guessing that means something like not overlapping other elements which is possible but would take a lot more code and thought to get working.

    If you clarify what you are trying to accomplish we might have more suggestions.

  • Yes, I'm doing it by means of VBA. The criteria is coming from the database, so that not a problem. If the dimension is smaller then 2', then is would be leader out .

    Larry Wilson
    LWilson@LJBinc.com
     

  • Hi Larry,

    Would you mind reviewing the code in this first topic "VBA - V8i) Set Dimension Offset" from the search I performed: vba AND dimension AND text AND (move OR offset); and see if it helps?  If not, would you mind attaching a simplified standalone version of a .mvba project for others to possibly help contribute to directly?

    Thank you and HTH,
    Bob



  • I did do a search and did find that page. The problem I ran into was that all the links on that page produces a oops page, page had been moved or is no longer available. The mvba reads an excel file, so I would be had for someone to run. Here is the code in use, the modify works sometimes


    CadInputQueue.SendKeyin "DIMCREATE LINEAR MODE SIZE"
    CadInputQueue.SendCommand "DIMCREATE LINEAR " 'dim vertical X

    If fLJB_InsertLocations.TBV.Value < 3 Then
    CadInputQueue.SendCommand "DIMSTYLESET FITOPTIONS FITOPTION OUTSIDE " 'outside dimensions
    CadInputQueue.SendCommand "DIMCREATE LINEAR "


    ElseIf fLJB_InsertLocations.TBV.Value >= 3 Then
    CadInputQueue.SendCommand "DIMSTYLESET FITOPTIONS FITOPTION INSIDE " 'inside dimensions

    End If
    CadInputQueue.SendCommand "DIMSTYLESET SINGLELOCATION RIGHTEXTENSION ON " 'right extension off
    CadInputQueue.SendCommand "DIMSTYLESET SIZEARROW RIGHTEXTENSION ON "
    CadInputQueue.SendCommand "DIMSTYLESET SINGLELOCATION LEFTEXTENSION ON " 'left extension off
    CadInputQueue.SendCommand "DIMSTYLESET SINGLELOCATION LEFTEXTENSION ON "
    CadInputQueue.SendCommand "DIMSTYLESET EXTENSIONLINES OFFSET .5"

    CadInputQueue.SendDataPoint RB
    CadInputQueue.SendDataPoint R1
    CadInputQueue.SendDataPoint VD
    CadInputQueue.SendReset




    CadInputQueue.SendKeyin "ac=440" 'Place Cell
    CadInputQueue.SendDataPoint L2, 1
    CadInputQueue.SendDataPoint R2, 1
    CadInputQueue.SendReset

    CadInputQueue.SendCommand "DIMSTYLESET SINGLELOCATION RIGHTEXTENSION ON " 'right extension off
    CadInputQueue.SendCommand "DIMSTYLESET SIZEARROW RIGHTEXTENSION ON "
    CadInputQueue.SendCommand "DIMSTYLESET SINGLELOCATION LEFTEXTENSION ON " 'left extension on
    CadInputQueue.SendCommand "DIMSTYLESET SIZEARROW LEFTEXTENSION ON "
    CadInputQueue.SendCommand "DIMSTYLESET EXTENSIONLINES OFFSET 0"

    EL.x = L2.x 'math for EL @ L2
    EL.Y = L2.Y + 1
    EL.Z = L2.Z

    If fLJB_InsertLocations.TBW.Value < 3 Then
    CadInputQueue.SendCommand "DIMSTYLESET FITOPTIONS FITOPTION OUTSIDE " 'outside dimensions
    CadInputQueue.SendCommand "DIMCREATE LINEAR "


    ElseIf fLJB_InsertLocations.TBW.Value >= 3 Then
    CadInputQueue.SendCommand "DIMSTYLESET FITOPTIONS FITOPTION INSIDE " 'inside dimensions

    End If
    CadInputQueue.SendKeyin "DIMCREATE LINEAR MODE SIZE"
    CadInputQueue.SendCommand "DIMCREATE LINEAR "
    CadInputQueue.SendDataPoint L2
    CadInputQueue.SendDataPoint L1
    CadInputQueue.SendDataPoint EL
    CadInputQueue.SendReset




    EL.x = R2.x 'math for EL @ R2
    EL.Y = R2.Y + 1
    EL.Z = R2.Z

    If fLJB_InsertLocations.TBW.Value < 3 Then
    CadInputQueue.SendCommand "DIMSTYLESET FITOPTIONS FITOPTION OUTSIDE " 'outside dimensions
    CadInputQueue.SendCommand "DIMCREATE LINEAR "


    ElseIf fLJB_InsertLocations.TBW.Value >= 3 Then
    CadInputQueue.SendCommand "DIMSTYLESET FITOPTIONS FITOPTION INSIDE " 'inside dimensions


    End If

    CadInputQueue.SendKeyin "DIMCREATE LINEAR MODE SIZE"
    CadInputQueue.SendCommand "DIMCREATE LINEAR "
    CadInputQueue.SendDataPoint R2
    CadInputQueue.SendDataPoint R1
    CadInputQueue.SendDataPoint EL
    CadInputQueue.SendReset



    R4.x = R2.x
    R4.Y = R2.Y
    R4.Z = R2.Z



    R4 = R1

    Dim vd1 As Point3d

    CadInputQueue.SendKeyin "DIMCREATE LINEAR MODE SIZE"
    CadInputQueue.SendCommand "DIMCREATE LINEAR " 'dim vertical Z

    If fLJB_InsertLocations.TBW.Value < 3 Then
    CadInputQueue.SendCommand "DIMSTYLESET FITOPTIONS FITOPTION OUTSIDE " 'outside dimensions
    CadInputQueue.SendCommand "DIMCREATE LINEAR "


    ElseIf fLJB_InsertLocations.TBW.Value >= 3 Then
    CadInputQueue.SendCommand "DIMSTYLESET FITOPTIONS FITOPTION INSIDE " 'inside dimensions

    End If

    ActiveSettings.DimensionStyle.PrimaryAccuracy = msdDimAccuracy16th
    CadInputQueue.SendCommand "DIMSTYLESET SINGLELOCATION RIGHTEXTENSION ON " 'right extension off
    CadInputQueue.SendCommand "DIMSTYLESET SINGLELOCATION LEFTEXTENSION ON " 'left extension off
    CadInputQueue.SendCommand "DIMSTYLESET EXTENSIONLINES OFFSET .5" 'set off set to .5


    Dim TempPt As Point3d

    TempPt.x = VD.x
    TempPt.Y = RT.Y
    TempPt.Z = RT.Z



    CadInputQueue.SendDataPoint R1
    CadInputQueue.SendDataPoint RT
    CadInputQueue.SendDataPoint TempPt
    CadInputQueue.SendReset

    If fLJB_InsertLocations.TBW.Value < 3 Then
    point1.x = VD.x - RT.x - 1
    point1.Y = VD.Y - RT.Y + 1
    point2.x = RT.x + 0.5
    point2.Y = RT.Y
    CadInputQueue.SendCommand "MODIFY ELEMENT"
    CadInputQueue.SendDataPoint point1, 1
    CadInputQueue.SendDataPoint point2, 1
    CommandState.StartDefaultCommand
    CadInputQueue.SendReset
    CadInputQueue.SendReset

    End If

    Larry Wilson
    LWilson@LJBinc.com
     

  • Unknown said:

    I did do a search and did find that page. The problem I ran into was that all the links on that page produces a oops page, page had been moved or is no longer available.

    Those have been fixed... apologies for the inconvenience (and thanks for pointing that out).

      

  • Thanks Phil, the examples are not really what I'm looking for. I need some code that will take the last dimension placed and modify the text placement.

    Larry Wilson
    LWilson@LJBinc.com
     

Reply Children
No Data