Subject:
|
Re: Quick way to mirror-image a model?
|
Newsgroups:
|
lugnet.cad
|
Date:
|
Thu, 17 Jun 2004 14:31:27 GMT
|
Viewed:
|
1706 times
|
| |
| |
In lugnet.cad, Steve Krass wrote:
> In lugnet.cad, Carl Nelson wrote:
> > Hi--
> >
> > Does anybody know a quick way to do a mirror image of an LDraw model? For
> > example, a castle that I'm working on has a left and right tower that are mirror
> > images (not rotations) of each other (and the rear corner towers are mirrors of
> > the front ones). Rather than make 4 different models, is there a quick way to
> > flip my model into the four different towers?
> >
> > Thanks for the help!
> > Carl
>
> I usually use submodels save your tower as a tower-left or something. you have
> to go thruogh each part and change either the x or z value to the opposite value
> (ex. if the X is -300 change to 300) then rotate each part 180 degrees. There
> are also a lot of left and right parts which need to be swaped.
>
> or in povray you can use scale with a negative value (ex. scale<-1,0,0> ) this
> will mirror around the x axis.
>
> There is no easy way.
The way I usually do this is clunky, but it basically works. It also requires a
little familiarity with MS Excel and some kind of text editor, as well as an
understanding of the LDraw DAT-file format.
Create a backup of the MOC file. Open the backup file in MS Excel, in "space
delimited" format. For simplicity, let's assume the following:
1. Any title info within the DAT file is omitted for this operation
2. The ZERO character in line one at the start of the file appears in
cell A1 in the Excel spreadsheet
3. The first linetype 1 statement begins in cell B2 in the Excel spreadsheet
Here's how I do what I do when I do it:
For simple mirroring of the parts from left-to-right. This only works for parts
oriented along the X, Y, and Z axes. If parts are rotated at odd angles (like
30 degrees, or whatever), then this won't quite work, but it should get you
started.
1. Identify which lines contain the parts of the model that you want to
mirror (let's say lines 2 through 50).
2. Copy these lines to another location in the file (let's say 51 through 99)
3. Set cell D51 to equal "-D2"
4. Select cell D51 and "copy"
5. Select cells D52 through D99
6. Paste
At this point the parts now exist in their original locations and at the
corresponding mirrored locations, but the mirrored locations are not oriented
correctly. To correct the orientation, do the following:
1. Select cell D51 and "copy"
2. Select cells G51 through G99
3. Paste
This will invert the orientation left-to-right and vice versa.
To perform the same mirroring front-to-back, perform the same steps as above,
but instead of using columns D and G, you'd use columns F and O, respectively.
To perform the same mirroring up-to-down, perform the same steps as above, but
instead of using columns D and G, you'd use columns E and K, respectively.
After you have made all of your changes, save the Excel spreadsheet in
tab-delimited format, and use the .DAT extension in the file name, such as
"MOC1.dat"
At this point, the body of the MOC1.dat file has a bunch of tab characters where
there should be spaces. Open the MOC1.dat file in a text-based editor that
allows you to do bulk find-replace operations, and replace each of the "tab"
characters with a single space.
Save the file and open it in your LDraw platform of choice to view the results.
Here's a Known Shortcoming of this method: it doesn't automatically accommodate
linetype zero statements that appear within the body of the DAT file, nor does
it automatically accommodate METASTATEMENTS. You'll need to tweak those
manually if they present a problem.
I apologize if my explanation is unclear, but I can attest to the effectiveness
of the method, because I've used it dozens of times for model files and for new
partfiles. Let me know if you'd like clarification on any point.
Best of luck!
Dave!
|
|
Message has 2 Replies: | | Re: Quick way to mirror-image a model?
|
| (...) L (...) This is silly. Just put the structure you want to mirror in a subfile and do this. 1 0 0 0 0 1 0 0 0 1 0 0 0 1 subfile.ldr 1 0 320 0 0 -1 0 0 0 1 0 0 0 1 subfile.ldr You can do it in ldglite using the scale by (-1,1,1) command (just (...) (20 years ago, 17-Jun-04, to lugnet.cad)
| | | Re: Quick way to mirror-image a model?
|
| (...) Thanks for the responses--they were very helpful. I found the disadvantage to Don's rotation matrix method to be that when it's used the mouse commands in MLCad are reversed, i.e., dragging the part left moves it right--but it sure worked (...) (20 years ago, 17-Jun-04, to lugnet.cad)
|
Message is in Reply To:
| | Re: Quick way to mirror-image a model?
|
| (...) I usually use submodels save your tower as a tower-left or something. you have to go thruogh each part and change either the x or z value to the opposite value (ex. if the X is -300 change to 300) then rotate each part 180 degrees. There are (...) (20 years ago, 17-Jun-04, to lugnet.cad)
|
65 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|