Jump to content

Arrow (vector resultant) with text aligned


rog1n

Recommended Posts

Hello, I trying to make a lisp to insert (or maybe draw) a arrow that shows the value and angle of a vector resultant (this part is ok) , my problem is I need to insert the atributtes aligned like that:

 

9k447c.png 

 

but if I try to use rotation in this block the text is wrong orientation when angle is >90° and <269° like that:

 295g4lj.png

 

I tryng to use actions of dynamic block but I dont know how to control this actions by lisp. I need help with this or maybe a better solution to do this, can you help me?

r.dwg

Link to comment
Share on other sites

Can you post the drawing in 2010 format, as well as any lisp you already have. Its a simple matter of redefining each attributes rotation once the block is inserted if the angle is within the range.

Edited by dlanorh
Link to comment
Share on other sites

Hello,

(defun c:test ()
  (setq centro (getpoint "\nEntre com o ponto central do diagrama: "))
 ;I have a function that return me angR (in radians) and FR as string
  (setq angR 2.617993878) ; Just for example angR=150 degrees and FR=100 DaN
  (setq FR "100 DaN")
  (command "-insert" "r" "_s" "1" centro (angtos angR) FR (angtos angR))
)

r.dwg

Link to comment
Share on other sites

Do more searching here there is a dynamic block that looks at the orientation and changes the text angle, it uses 4 attributes and changes the invisibilty of 3 of them so arrow is always correct. I remember making some comments

Edited by BIGAL
Link to comment
Share on other sites

Attached are a drawing "IR.dwg" which contains a revised block and a lisp "IR.lsp"

 

I have removed one of the rotation parameters from the block as it wasn't needed, and rename the remaing one to "Text_Ang". The block is inserted at the entered rotation angle. I have also altered the block contents so that they are on layer "0" and color "byblock", so that the block is universal. I have also altered the attribute justifications to "middle" for the "R" attribute and "middle center" for the "A" attribute.

 

Save the lisp file in your documents folder and load it by typing "appload" then navigating to where you have saved it, selecting it and press the "load" button, then the "close" button.

Type "IR" on the command line to start the lisp.

 

I have assumed that you are working in Degrees, but the lisp is altereable if you are not.

 

It will ask for the insertion point, the angle you require it at (in degrees) and the force? (attribute "R" text)

 

It will then insert the block on the current active layer at the specified angle and will fill in the block attributes.

 

If the block rotation is >90 and <270 it will automaticaly rotate the attributes to a readable position.

 

There is no error checking.

 

If you require the block to always be on a certain layer; it is possible to expand the lisp to ensure that the layer is present and create it if not, then insert the block onto that layer.

 

Any problems let me know.

 

IR.dwg

IR.lsp

Edited by dlanorh
spelling
Link to comment
Share on other sites

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...