Jump to content

Recommended Posts

Posted

Hey guys, I'm gonna revive this thread... I tried the method above as I have the same request. However, when I go to the Chain Action option, it gives me an Error "Item was Deleted." Not sure what's happening. Then if I go to test the block, none of my new parameter sets show up. Anything? 

  • Replies 26
  • Created
  • Last Reply

Top Posters In This Topic

  • tzframpton

    9

  • alanjt

    4

  • BIGAL

    2

  • NBC

    2

Top Posters In This Topic

Posted Images

Posted

Can you post the block, we might be able to see what the problem is.

Posted

I ended up starting from scratch with new geometry, and got it to work. Unfortunately, because my geometry and my letter have different base points, it's a little weird, and I'm going to have to play with it... but I understand the premise now! 

Posted (edited)

Since the North arrow would be case sensitive based on the sheet configuration, viewport placement, etc... (in paper space) there are other options.

 

A viewport within a viewport would work fine.

One with the N text (perhaps a circle) within a larger circle containing the north arrow.  It would stay in model space - so if you rotate the viewport the North arrow will always be accurate and the N text always true.

 

The good thing about having circle viewports is they're easy to rotate around the center point without affecting anything..

 

If you have another rotated viewport, you could easily match the angle by using a reference line or using matchprop command.  There would be some additional steps, but it would work.

 

Although, an ideal method would be to have a LISP where you could click the viewport and it would insert the north arrow at a matching angle.

 

-ChriS

Edited by ammobake
Posted

I think this is the final version does what you want.

 

; Rotate a block in pspace to match world in model
; By Alan H Aug 2020

(defun c:roblklay ( / pt obj1 obj rot ent ang oldang mpt1 mpt2 oldangdir oldsnap oldaunits MAXPOINT MINPOINT OBJ2 POINTMAX POINTMIN PT1 PT2 PT3 PT4 SSS X)
(vl-load-com)
(command "._PSPACE")
(setq oldang (getvar 'aunits))
(setvar 'aunits 3)
(setq oldangdir (getvar 'angdir))
(setvar 'angdir 0)
(setq oldsnap (getvar 'osmode))
(setvar 'osmode 512)
(princ "\n")
(setq pt (getpoint "\nSelect a viewport"))
(setvar 'osmode 0)
(setq pt1 (mapcar '+ pt (list 1.4 1.4 0.0)))
(setq pt2 (mapcar '+ pt1 (list -2.0 0.0 0.0)))
(setq pt3 (mapcar '+ pt2 (list  0.0 -2.0 0.0)))
(setq pt4 (mapcar '+ pt2 (list  2.0 0.0 0.0)))
(setq sss (ssget "F" (list pt1 pt2 pt3 pt4)))
(repeat (setq x (sslength sss))
(if (= (cdr (assoc 0 (entget (ssname sss (setq x (- x 1)))))) "VIEWPORT")
(setq obj1 (vlax-ename->vla-object (ssname sss x)))
)
)
(setq ang (vlax-get obj1 'TwistAngle))
(setq ent (entsel "\nPick block "))
(command "ucs" "ob" ent)
(setq obj (vlax-ename->vla-object (car ent)))
(vla-GetBoundingBox obj 'minpoint 'maxpoint)
(setq pointmin (vlax-safearray->list minpoint))
(setq pointmax (vlax-safearray->list maxpoint))
(command "ucs" "w")
(setq mpt1   (mapcar '/ (mapcar '+ (trans pointmin 1 2) (trans pointmax 1 2)) (list 2.0 2.0 2.0) ))
(vla-put-rotation obj 0.0)
(setq obj2 (vlax-ename->vla-object (car ent)))
(vla-GetBoundingBox obj2 'minpoint 'maxpoint)
(setq pointmin (vlax-safearray->list minpoint))
(setq pointmax (vlax-safearray->list maxpoint))
(setq mpt2 (mapcar '/ (mapcar '+ pointmin pointmax ) (List 2.0 2.0 2.0)))
(command "move" ent "" mpt2 mpt1)
(command "rotate" ent "" mpt1 ang)
(setvar 'aunits oldang)
(setvar 'angdir oldangdir)
(setvar 'osmode oldsnap)
(princ)
)

 

Posted

Cool that works.

If you want the North arrow to stay static you can apply the ROBLKLAY lisp to just the arrow portion and have the N text stay at zero rotation. 

 

I'm curious if this can be done in one block but I don't think it can.

it might be possible to apply constraints to keep the rotation of the N text at zero but any rotation applied to the parent would rotate everything - even with the constraints applied.

 

-ChriS

 

NorthArrow_TEST.jpg

Posted

I would have thought the N is always orientated in the direction of the arrow, in a dynamic block maybe rotate 180 so its not up side down.

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