insert coordinates not in the spot specified

insert coordinates not in the spot specified

Anonymous
Not applicable
640 Views
5 Replies
Message 1 of 6

insert coordinates not in the spot specified

Anonymous
Not applicable

Ok this is a really wierd one.

 

the insert is not putting it in the spot specified.  The coordinates in the insert is correct but it puts the object in a different spot for the first time but is correct the rest of the time????   It's driving me crazy lol

 

projmode is set to 0

osnap os off 

grid is off

 

It just started doing this recently....I think after I upgraded to windows 10.  Before that it all worked fine.

I added in the freeze and thaw layers to try and correct it, which worked for the rest of the program.but doesn't seem to work here.

 

 

 

This is the part of the program that is still acting up... any ideason what is going on????

 

 

		(repeat	ldspnm2
		  (setq	ladsuppt
			 (list Tankofmv
			       (+ (+ TANKTOCYL CALC1) EPL1)
			       ldspstart
			 )
		  )
		  (command "-view" "o" "t")
  (prompt "\n")
  (princ "ladsuppt : ")
  (princ ladsuppt)
  (prompt "\n")
		  (command "layer" "f" "*" "")
		  (command
		    "_insert"
		    "C:/3D Storage Tank Generator/3D files/Ladders/Ladder Supports.DWG"
		    ladsuppt
		    ""
		    ""
		    ""
		   )		  
		  (command "layer" "thaw" "*")
		  (command "explode" "l" "")
		  (setq ldspstart (+ ldspstart ldspspc))
		  (setq CNTR 0)
		  (setq TKCHT1 0)
		  (setq TKCHT2 (nth 0 TCHT))
		  (if (<= TKCHT1 0)
		    (setq TKCHT1 (- TKCHT1 THGT))
		  )
		  (if (< TKCHT2 0)
		    (setq TKCHT2 (- TKCHT2 THGT))
		  )
		  (repeat NC
		    (cond
		      (
		       (and (< TKCHT1 ldspstart) (> TKCHT2 ldspstart))
		       (setq CTHK (nth CNTR TCTT))
		       (setq crsnum CNTR)
		       (setq
			 rpdx1a
			  (- (* TANKTOCYL -1) (+ BTR (/ CTHK 2)))
		       )
		      )
		    )
		    (setq TKCHT1 (+ TKCHT1 (nth CNTR TCHT)))
		    (setq CNTR (+ CNTR 1))
		    (if	(/= (nth CNTR TCHT) nil)
		      (setq TKCHT2 (+ TKCHT2 (nth CNTR TCHT)))
		    )
		  )
		  (setq rpdy1 (* (* THGT 2) -1))
		  (setq rpdy2 (* THGT 2))
		  (setq pltrpd 2)
		  (setq cnt 1)
		  (repeat pltrpd
		    (cond
		      (
		       (= cnt 1)
		       (setq pltlyr "SupTrim3")
		       (setq rpdx1 rpdx1a)
		       (setq sptrm "SupTrim1")
		      )
		      (
		       (= cnt 2)
		       (setq pltlyr "SupTrim4")
		       (setq rpdx1 rpdx1a)
		       (setq sptrm "SupTrim2")
		      )
		    )		    
		    (setq rpdx2 (- rpdx1 0.25))
		    (command "-view" "o" "ba")
		    (command "zoom" "W" winpt1 winpt2)
		    (setq ss   (ssget "X" (list (cons 8 pltlyr)))
			  cntr (1- (sslength ss))
		    )
		    (setq ssent nil)
		    (while
		      (>= cntr 0)
		       (setq
			 ssent (append ssent (list (ssname ss cntr)))
		       )
		       (setq cntr (1- cntr))
		    )
		    (setvar 'clayer pltlyr)
		    (command "extrude" (nth 0 ssent) "" -72)
		    (command "-view" "o" "l")
		    (command "zoom" "W" winpt1 winpt2)
		    (setq PT1 (list rpdx1 rpdy1 (* Tankofmv -1)))
		    (setq PT2 (list rpdx2 rpdy2 (* Tankofmv -1)))
		    (command "layer" "f" "*" "")
		    (command "rectangle" PT1 PT2)
		    (setq
		      PT1
		       (list (* TANKTOCYL -1) rpdy1 (* Tankofmv -1))
		    )
		    (setq
		      PT2
		       (list (* TANKTOCYL -1) rpdy2 (* Tankofmv -1))
		    )
		    (command "revolve" "l" "" PT1 PT2 "" "")
		    (command "layer" "thaw" "*" "")
		    (setq winpt1 (list TDIA (- TDIA (* TDIA 6))))
		    (setq winpt2 (list (- TDIA (* TDIA 2)) TDIA))
		    (setq ss   (ssget "X" (list (cons 8 pltlyr)))
			  cntr (1- (sslength ss))
		    )
		    (setq ssent nil)
		    (while
		      (>= cntr 0)
		       (setq
			 ssent (append ssent (list (ssname ss cntr)))
		       )
		       (setq cntr (1- cntr))
		    )
		    (command "intersect" (nth 0 ssent) (nth 1 ssent) "")
		    (setq ss   (ssget "X" (list (cons 8 pltlyr)))
			  cntr (1- (sslength ss))
		    )
		    (setq ssent nil)
		    (while
		      (>= cntr 0)
		       (setq
			 ssent (append ssent (list (ssname ss cntr)))
		       )
		       (setq cntr (1- cntr))
		    )
		    (setq elist (entget (nth 0 ssent)))
		    (setq
		      elist
		       (subst (cons 8 "Repad") (assoc 8 elist) elist)
		    )
		    (entmod elist)
		    (setq cnt (+ cnt 1))
		    (setvar 'clayer "Pipe2")
		    (setq PT1 (list (+ rpdx1 36) rpdy1 (* Tankofmv -1)))
		    (setq PT2 (list rpdx2 rpdy2 (* Tankofmv -1)))
		    (command "layer" "f" "*" "")
		    (command "rectangle" PT1 PT2)
		    (setq
		      PT1
		       (list (* TANKTOCYL -1) rpdy1 (* Tankofmv -1))
		    )
		    (setq
		      PT2
		       (list (* TANKTOCYL -1) rpdy2 (* Tankofmv -1))
		    )
		    (command "revolve" "l" "" PT1 PT2 "" "")
		    (command "layer" "thaw" "*" "")
		    (setq ss1  (ssget "X" (list (cons 8 sptrm)))
			  cntr (1- (sslength ss1))
		    )
		    (setq ssent1 nil)
		    (while
		      (>= cntr 0)
		       (setq
			 ssent1
			  (append ssent1 (list (ssname ss1 cntr)))
		       )
		       (setq cntr (1- cntr))
		    )
		    (setq ss2  (ssget "X" (list (cons 8 "Pipe2")))
			  cntr (1- (sslength ss2))
		    )
		    (setq ssent2 nil)
		    (while
		      (>= cntr 0)
		       (setq
			 ssent2
			  (append ssent2 (list (ssname ss2 cntr)))
		       )
		       (setq cntr (1- cntr))
		    )
		    (command "subtract"
			     (nth 0 ssent1)
			     ""
			     (nth 0 ssent2)
			     ""
		    )
		    (setq ss1  (ssget "X" (list (cons 8 sptrm)))
			  cntr (1- (sslength ss1))
		    )
		    (setq ssent1 nil)
		    (while
		      (>= cntr 0)
		       (setq
			 ssent1
			  (append ssent1 (list (ssname ss1 cntr)))
		       )
		       (setq cntr (1- cntr))
		    )
		    (setq elist (entget (nth 0 ssent1)))
		    (setq
		      elist
		       (subst (cons 8 "LADSup") (assoc 8 elist) elist)
		    )
		    (entmod elist)
		  )			;***********************************
		)
0 Likes
Accepted solutions (1)
641 Views
5 Replies
Replies (5)
Message 2 of 6

kerry_w_brown
Advisor
Advisor

 

There seems to be a lot of code there that is not related to the issue...

and the important code that sets the insertion point is untestable.

 

What is the value difference between the actual insertion point and the variable ladsuppt ?


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 3 of 6

kerry_w_brown
Advisor
Advisor

and what is the value for

ldspnm2
Tankofmv
TANKTOCYL

CALC1

 EPL1
ldspstart
ldspspc

TCHT

NC

TCTT

 

etc, etc, etc


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 4 of 6

Anonymous
Not applicable

The first time through ladsuppt is (1320.0,-1092.94,-151.0) but it places it at (1305.25, -1086.9375, -35) every other time it goes through it places it in the correct spot.

0 Likes
Message 5 of 6

ВeekeeCZ
Consultant
Consultant
Accepted solution

Check OSNAPZ...

 

but personally I would put "_none" as osnap in front of each point inserting with command.

 

(command
		    "_insert"
		    "C:/3D Storage Tank Generator/3D files/Ladders/Ladder Supports.DWG"
		    "_none" ladsuppt
		    ""
		    ""
		    ""
		   )

 

0 Likes
Message 6 of 6

Anonymous
Not applicable

Nice 🙂 that did the job.

 

Still not sure why it all stopped working in the first place but this was the last part that needed to be fixed I think.

 

 

thanks for the help

0 Likes