Jump to content

Recommended Posts

Posted

Ok guys. I'm back, big as life and twice as ugly :D.

Here's my problem. I have a function in vba that I use to draw some dimensions between points. The type of dim is Aligned and the problem is,

after I create the dim, I don't know how to set it's layer. I want all my dims to be in a layer let's say 'layerX'.

Public Sub drawDimSupra(pIn1 As Variant, pIn2 As Variant)


Dim tip As Integer
Dim cota As AcadDimAligned
Dim pText As Variant
Dim pStart As Variant
Dim pEnd As Variant

pStart = pIn1
pEnd = pIn2
pText = pStart
pText(0) = (pStart(0) + pEnd(0)) / 2
pText(1) = (pStart(1) + pEnd(1) + 70) / 2

Set cota = ThisDrawing.ModelSpace.AddDimAligned(pStart, pEnd, pText)

cota.Layer = "layerX"

End Sub

 

And it does not work. Any help ?

Posted
:)) Weird stuff. Friday the same subroutine gave me an error. Now it works.
Posted

The routine will error if the layer “layerX” does not already exist in the current drawing.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...