dwg not imported where I expected

dwg not imported where I expected

Anonymous
Not applicable
1,231 Views
13 Replies
Message 1 of 14

dwg not imported where I expected

Anonymous
Not applicable

Hi all!

 

I have a lisp file, and it defines several points, I want to import a dwg file onto one of these points. I defined the point correctly, but the dwg I want to paste there is always out by the same amount, it's 12 above where it needs to be and 427 to the right. Now I could just define another point to account for this, but I'd rather figure out how to adjust the dwg in question to import properly if possible, it's been driving me nuts for a good portion of the day.

 

Does anyone have any ideas?

 

thanks in advance

 

Dave

0 Likes
1,232 Views
13 Replies
Replies (13)
Message 2 of 14

Anonymous
Not applicable

is the drawing that you are importing on the origin? turn the grid on and check because ive had something similar happen and this was the case

Message 3 of 14

SeeMSixty7
Advisor
Advisor

open the drawing you are importing, and then check where it's actual INSBASE is. It sounds like it is set to something other than 0,0,0. It is probably set to 427,12,0 or something like that. if it is simply set insbase to 0,0,0

 

Good luck and hope that helps,

 

Message 4 of 14

Anonymous
Not applicable

Thanks for thew suggestion, but it looks okay to me.

0 Likes
Message 5 of 14

Anonymous
Not applicable

I was so hopeful this would be the solution, as yet, it doesn't seem to want to play ball, I'll post the dwg, and see if anyone has any more suggestions. The insertion point I'm after is where the origin is, and I did have to play with INSBASE, it was off like you suggested, I'm certain the insert point is correct too, (I've drawn a line to it, so I know where it is!). If anyone has any more to suggest, I'm all ears.

 

Thanks for the help so far!

 

Dave

0 Likes
Message 6 of 14

Anonymous
Not applicable

I thought I'd better post the lsp file as well in case I've screwed it up, "ventpoint" is where it's meant to go, on top of a roof, but it persists in floating off a little up and to the right. the relevant stuff is near the end of the code.

0 Likes
Message 7 of 14

SeeMSixty7
Advisor
Advisor

Looking at the drawing you uploaded, the WCS is at a different location than your UCS. This is not an issue for just inserting, as the insert command will actually use the current coordinates system. I have not looked at your lisp code yet, but I imagine you are getting points from entities in your drawing. When AutoLISP gets information from an entity, it will return WCS coordinate information, It will not return the UCS information. To test make sure that when you run your routine you start off in the WCS. (Run the UCS command and then just hit enter to set it to WCS)

 

Good luck,

Message 8 of 14

Anonymous
Not applicable

I'm sure there's wisdom in what you've said, I'm just not understanding it yet. It's taken my reading in a different direction, I haven't really had any need to appreciate the differences in the coordinate systems, I will continue to scratch my head about this, when/if something clicks into place in my head, I'm sure it will be very obvious, and I will feel very stupid. Thanks for the help, even if it's a little beyond my abilities to grasp its full meaning at the moment!

Message 9 of 14

Anonymous
Not applicable

I guess you could think about it this way (im not sure how much you know about relative coordinate systems) so your UCS or User Coordinate System is different from your WCS of World Coordinate System. Your UCS is like a local Coordinate system that is relative to the world coordinate system. think of it as a separate x and y axis. where WCS is in X and Y and UCS is in x and y. so your WCS isn't necessarily in the same location or orientation as your UCS. I hope that helps a little bit 

Message 10 of 14

SeeMSixty7
Advisor
Advisor

I wrote a blog about UCS's. It might help be of some help.

 

http://www.seemsixty7.com/blog/2017/04/25/cad-intermediate-what-is-ucs-for-anyway/

 

Basically AutoCAD has the ability to work in different places utilizing a different origin location, including different X,Y, and Z vectors. You can pick any point in an AutoCAD drawing and create a UCS from it, you can rotate the X,Y and or Z axis as needed. It is really beneficial in 3D Modeling, as well as many other project types.

 

Each entity in AutoCAD is stored in the AutoCAD database of that drawing. The coordinates are stored using World Coordinates of that drawing. It does not mean actual WORLD as in Earth Coordinates. It is basically just a Cartesian coordinate system that includes the Z axis.

 

Try this.

 

Start a new drawing. draw a line from 0,0,0 to 1,1,0

 

Then look at it's DXF data using:

(entget (entlast))

((-1 . <Entity name: 7ffffb064e0>) (0 . "LINE") (330 . <Entity name: 7ffffb03820>) (5 . "51E") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbLine") (10 0.0 0.0 0.0) (11 1.0 1.0 0.0) (210 0.0 0.0 1.0))

Look at the 10 and 11 values. The appear as they should.

Use the UCS command to create a new UCS with simply a new XY origin.

 

Command: ucs
Current ucs name:  *WORLD*
Specify origin of UCS or [Face/NAmed/OBject/Previous/View/World/X/Y/Z/ZAxis] <World>: n
Specify origin of new UCS or [ZAxis/3point/OBject/Face/View/X/Y/Z] <0,0,0>: 5,5,0

 

Now draw another line from the new ucs origin as we did before from 0,0,0 to 1,1,0

Now look at the dxf data for it.

(entget (entlast))

((-1 . <Entity name: 7ffffb064f0>) (0 . "LINE") (330 . <Entity name: 7ffffb03820>) (5 . "51F") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbLine") (10 10.0 10.0 0.0) (11 11.0 11.0 0.0) (210 0.0 0.0 1.0))

 

Notice the 10 and 11 points are not as they were before. The coordinates are WCS based not the UCS based one we just typed in.

 

Switch back to WCS

UCS

[Enter] to accept WCS

now if you use the ID command or list the last line, you will see the coordinates match the values listed in the dxf data we reviewed. You can also see that even though we drew both lines from 0,0,0 to 1,1,0 they are not in the same location.

 

Hopefully that helps some,

 

 

 

Message 11 of 14

Anonymous
Not applicable

I kind of get it in theory, but I haven't had any good reason to delve into it until now, thanks for the explanation, it confirms my thinking is on the right lines even if my software knowledge isn't up to scratch. 

Message 12 of 14

Anonymous
Not applicable

Graphics3D_LocalSpace

 

 

Message 13 of 14

Anonymous
Not applicable

Okay, I followed along, and I think I've understood all that, I've still got a floating vent though, and I can't figure out what the problem is But I've learned a bunch of new commands which is nice 🙂 this will have to wait, at least until tomorrow, right now work has been a bit slack, which is allowing me the time to play with this, but tomorrow may be busy, you never know how things will go here.

 

I thought and as it turns out I was wrong, that if I just moved the vent down and to the left on the dwg I posted it would sort it out and paste it in a relatively different location. Then I thought I'll just move it to it's world origin, and see if that helps, it didn't, then I put an new ucs in line with the wcs, just in case that would help, needless to say, it didn't.

 

So I'll sleep on it, but if you have anything further to add I'll be sure and try it out in the near future. I'll get to the blog post soon, and see if that can shed any light on things.

 

Thanks again for the help!

Message 14 of 14

Anonymous
Not applicable

Nice graphic, puts it visually for me Smiley Happy affine transforms will be a vector thing I suppose, it's been a while since I even looked at a vector, but it could be fun.

0 Likes