Can't get flip option to work

Can't get flip option to work

DC-MWA
Collaborator Collaborator
444 Views
6 Replies
Message 1 of 7

Can't get flip option to work

DC-MWA
Collaborator
Collaborator

Getting "Points must be distinct " message.

Please help..

 

(if (= Resoption "11A")
      (progn
  ;(prompt "\n PICK INSERTION POINT:")
(setq PT1 (getpoint "\nPICK INSERTION POINT: "))
  (command "insert" "toilet1-11A" PT1 "" "")
  (prompt "\n ROTATION?:")
(setq PT2 (pt1 getpoint "\nROTATION?: "))
  (command PT2)
;(setq PT2 (getvar "lastpoint"))
;;;;;;start flip
(initget "Yes No")
(setq Flip_yn
(cond
( (getkword "\nFlip Toilet? [Yes/No] <No>: ") )
( "No" )
))
(if (= Flip_yn "Yes")(vl-cmdf "._mirror" (entlast) "" PT1 PT2 "_Y"))
(if (= Flip_yn "No")(Princ "\nNo flip..."))
;;;;;;end flip
    );pr
);if
0 Likes
Accepted solutions (1)
445 Views
6 Replies
Replies (6)
Message 2 of 7

Kent1Cooper
Consultant
Consultant

I wouldn't expect that particular message for the error I see, but in any case....

 

The AutoLisp function name comes first in the parentheses.  Try changing this:

(setq PT2 (pt1 getpoint "\nROTATION?: "))

to this:

(setq PT2 (getpoint pt1 "\nROTATION?: "))

Kent Cooper, AIA
0 Likes
Message 3 of 7

DC-MWA
Collaborator
Collaborator

That makes the flip work. Now I can't see the block on the rotation though...

I tried to use pause and get the point... no luck.

 

(command "insert" "toilet1-11A" PT1 "" "")
(prompt "\n ROTATION?:")
;(setq PT2 (getpoint pt1 "\nROTATION?: "))
 (command pause)
(setq PT2 (getvar "lastpoint"))
0 Likes
Message 4 of 7

Kent1Cooper
Consultant
Consultant

Unfortunately, when you specify the rotation of a Block insertion with a pick on-screen, that picked point is not saved as the "lastpoint" System Variable, but rather the insertion point goes into that.  Maybe that's because there's no point to consider if you were to specify the rotation by typing in an angle, so it doesn't save a picked point either if that's how you specify it.

 

And if you're getting the point with (getpoint) rather than within the ordinary operation of the Insert command, you won't see the dragging of the Block in rotation.

 

A suggestion:  Instead of using the Mirror command when flipping is chosen, how about assigning -1 to the X or Y scale factor [I can't tell which without knowing how your Block is defined]?  That way you don't need the PT1 or PT2 variables at all.  For example:

 

(if (= Resoption "11A")

  (progn ; then
    (command "insert" "toilet1-11A" pause "" "" pause)
    (initget "Yes No")
    (setq Flip_yn
      (cond
        ( (getkword "\nFlip Toilet? [Yes/No] <No>: ") )
        ( "No" )
      )

    )
    (if (= Flip_yn "Yes")
      {assign appropriate negative scale factor here}; then
      (prompt "\nNo flip..."); else
    ); if

  ); progn

); if

Kent Cooper, AIA
0 Likes
Message 5 of 7

DC-MWA
Collaborator
Collaborator

Ok. I'm sending you one of the blocks. They are all very similar.

And... thank you very much for your time.

0 Likes
Message 6 of 7

Kent1Cooper
Consultant
Consultant
Accepted solution

So the Y scale factor would be the one I assume you want to change to -1.  One way:

 

(vla-put-YScaleFactor (vlax-ename->vla-object (entlast)) -1.0)

 

But if I've misinterpreted the way you would use it, and it should flip the other way, just use XScaleFactor in place of YScaleFactor above.

 

It could also be done using (subst)/(entmod) methods in the Block's entity data.

 

Kent Cooper, AIA
0 Likes
Message 7 of 7

DC-MWA
Collaborator
Collaborator
Thanks! This is perfect.
0 Likes