automatic dimensions between block's base points

automatic dimensions between block's base points

Anonymous
Not applicable
6,769 Views
27 Replies
Message 1 of 28

automatic dimensions between block's base points

Anonymous
Not applicable

I would like to generate automatic dimensions after I placeded my blocks. In the pic there is an example. 

The blue blocks's base points are in the middle of them, and I would like to generate automatically the red measures.

 

I know continoue dimension method, but when I have 300 block, I don't want to clik on every of them.

 

QDIM simply does not work with block basepoints. 

 

Anyone have a lips for this?

I tried to watch hours long lips makeing tutorials, but I am too noob to understand it.

 

Thank you!

Accepted solutions (1)
6,770 Views
27 Replies
Replies (27)
Message 2 of 28

ВeekeeCZ
Consultant
Consultant
no pcs attached
Message 3 of 28

Anonymous
Not applicable

You're right! Sorry! Fixed it!

0 Likes
Message 4 of 28

ВeekeeCZ
Consultant
Consultant

Post some dwg sample.

Why you're saying mid of blk and not its insertion points. Does that mean they don't match? 

 

Also, how would we know the path? Does it match the order of creation?

 

SOmething like attached will work?

Message 5 of 28

Anonymous
Not applicable

Something like this. Now the basepoints of the blocks are in one corner of the poligon.

 

The qdim command would be absolutely perfect, but it doesn't  work with blocks. I would love to have a lips that can do the same thing as qdim, but can use the basepoints of the blocks.

 

Sorry for my bad Englsih, I hope you can understand.

Message 6 of 28

Anonymous
Not applicable

BlockDim is almost perfect!

Thank you!

Just two problems with it. The first is, that I can't tell it where to put the dimensions, (so after choosing from horisontal/vertical, I press enter and it drops down the dimensuions inmediatelly. Here an option to choose where to put the dimensions would be amazing (like in qdim))

 

The other is, like in the pic, if two block is in the same point horisontally or vertically, it puts a "0" dimension to them. with 300 blocks, it would be a lot of work to delete all of these.

 

But I say again,very big thank you, I am far closer to my goal.

 

0 Likes
Message 7 of 28

ВeekeeCZ
Consultant
Consultant
Accepted solution

Here's a quickie which makes qdim for blocks (only).

 

(defun c:BDIM (/ si sp i)

  (if (setq si (ssget '((0 . "INSERT"))))
    (progn
      (setq sp (ssadd))
      (repeat (setq i (sslength si))
	(ssadd (entmakex (list '(0 . "POINT") (assoc 10 (entget (ssname si (setq i (1- i))))))) sp))
      (command-s "_.qdim" sp "")
      (command "_.erase" sp "")))
  (princ)
  )

 

Message 8 of 28

Anonymous
Not applicable

Thank you!

I know I'm too noob, but where can I find the qdim command to rewrite with this in notepad?

0 Likes
Message 9 of 28

ВeekeeCZ
Consultant
Consultant

Not sure what you mean. We cannot change the original QDIM definition. 

Wherefrom or how you want to run the BDIM?

0 Likes
Message 10 of 28

Anonymous
Not applicable

Sorry, I missunderstanded something. 

But now it works fine.

 

Thank you for your help!!!

You saved me days in some projects.

0 Likes
Message 11 of 28

nilesh.bhosale
Advocate
Advocate

i was also looking this thanks it is working ...

 

but i want aligned dimensions ..it is taking vertical / horizontal dimensions

 

can this lisp modified to take aligned dimensions??

pl see below screen shot

nileshbhosale_0-1639116936801.png

 

0 Likes
Message 12 of 28

arpansark0544TCX
Advocate
Advocate

Check this lisp.

I don't know where I have found it. But it can be used to give aligned dimensions.

Hope this will be use full

0 Likes
Message 13 of 28

ahmednabil619
Explorer
Explorer

Hi Ty for that amazing lisp.

 

could you modify that lisp such that ask me the point which i want to take the dimension from instead of the base point of the block ?

0 Likes
Message 14 of 28

ВeekeeCZ
Consultant
Consultant

Not going to do that.

If you want to adjust the position of the block insertion point back and forth, try THIS routine.

0 Likes
Message 15 of 28

thsa2501
Enthusiast
Enthusiast

hii...,

i made this lisp myself.it does not work for me.I don't know where i mistook it.

kindly help me.

 

 

(vl-load-com)

(defun c:try2()

 

  (setq acDoc (vla-get-activedocument (vlax-get-acad-object))
        space (vlax-get acDoc (if (= (getvar 'cvport) 1) 'paperspase 'modelspace))
  )

   (setq ss (ssget '((0 . "insert"'))))
    (repeat (setq i (sslength ss))
     
    (setq ss_name (ssname ss (setq i (1- i))))
     (setq a (vlax-curve-getstartparam ss_name))
     (setq b (vlax-curve-getendparam ss_name)) 
     (setq p1 (vlax-curve-getpointatparam ss_name a)) 
     (setq p2 (vlax-curve-getpointatparam ss_name b))
	 (setq ang (p1 p2)
	        pm (vlax-curve-getpointatparam ss_name (/ (+ a b) 2.0))
	 )
	  (setq p3 (polar pm (+ (+ ang (/ pi 2))) 0.5))
     (vla-adddimaligned space (vlax-3d-point p1) (vlax-3d-point p2) (vlax-3d-point p3))
     


    )




)

 

 

 
0 Likes
Message 16 of 28

ВeekeeCZ
Consultant
Consultant

@thsa2501 wrote:

hii...,

i made this lisp myself.it does not work for me.I don't know where i mistook it.

kindly help me.

 

 

(vl-load-com)

(defun c:try2()

 

  (setq acDoc (vla-get-activedocument (vlax-get-acad-object))
        space (vlax-get acDoc (if (= (getvar 'cvport) 1) 'paperspase 'modelspace))
  )

   (setq ss (ssget '((0 . "insert"')))) ; <- extra ' needs to be removed
    (repeat (setq i (sslength ss))
     
    (setq ss_name (ssname ss (setq i (1- i))))
     (setq a (vlax-curve-getstartparam ss_name))
     (setq b (vlax-curve-getendparam ss_name)) 
     (setq p1 (vlax-curve-getpointatparam ss_name a)) 
     (setq p2 (vlax-curve-getpointatparam ss_name b))
	 (setq ang (p1 p2)
	        pm (vlax-curve-getpointatparam ss_name (/ (+ a b) 2.0))
	 )
	  (setq p3 (polar pm (+ (+ ang (/ pi 2))) 0.5))
     (vla-adddimaligned space (vlax-3d-point p1) (vlax-3d-point p2) (vlax-3d-point p3))
    ))
 

 

The issue that stops the code from loading is an extra ' as noted above.

 

BUT The entire algorithm is wrong. Your ss_name (note: a more convenient name would be e_name since it's an entity name = ename, not a selection set) is a BLOCK. But all vlax-curve-* functions work only with 'curves' as line, lwpolyline, circle, arc, ellipse... 

 

If you need some more help, post a dwg with an explanation of what youre after.

0 Likes
Message 17 of 28

thsa2501
Enthusiast
Enthusiast

hii beekeecz,

thanks for the reply.i thought vlax-curve works for block.

i need dimension in between block by selection method without clicking third point (i mean position placed dimension)

kindly find below the drawing for ur reference

0 Likes
Message 18 of 28

ВeekeeCZ
Consultant
Consultant

How about this...

0 Likes
Message 19 of 28

thsa2501
Enthusiast
Enthusiast

 

hi beekeecz,

yes, it works if i select the horizontal side or vertical. once select all blocks it will not work.

kindly check the image.

0 Likes
Message 20 of 28

ВeekeeCZ
Consultant
Consultant

So don't select all. Make a portion selection of those blocks that are clearly horizontal or vertical.

 

That's how it's designed. How to routine suppose to know which 2 should be dimed if they are criss-cross? 

 

Or better yet - you have a darn good starting point for your learning - so feel free to adjust my code as you wish it should work.