The DataCAD Developer Network (DDN) is an online resource for information and support for DCAL® (DataCAD Applications Language) developers as well as anyone interested in creating fonts, toolbars, hatch patterns, or linetypes for use in DataCAD.
#32348 by shovavnik
Mon Jan 28, 2008 6:12 pm
When I place a symbol entity in a drawing, I need to match up the symbol's scale to the drawing's scale.

It took me awhile to figure out that the current view's scale is not what I'm looking for, but some kind of underlying scale.

The question is, where do I get the underlying scale used by the drawing?

If I understand correctly, I'm looking for a value to pass to ent_enlarge. Jon C. Hubart uses a "globalscale" variable on this topic: http://forum.datacad.com/viewtopic.php?p=32267. How can i retrieve that globalscale?

This is how I know if get the right numbers. If I get a drawing whose underlying scale is 1:250 and another whose underlying scale is 1:2500 and set each of the view scales to the respective view scale, the drawings "look" the same in DC. Now if I add the same symbol (with whatever scale it uses internally) using DCAL to each of these drawings, the symbol ALSO needs to look the same on both. Currently, when I add the symbol to both drawings, it looks bigger on the one than on the other because the symbol's scale doesn't match.

I've tried the scalei/scale pair (with scalei = 0) on the view. I've tried savevar.scalexfacx/y/z. I've tried using various scales and factors from different structures. I'm not sure what the exact difference between all of them is, but I haven't yet found one that works.

Is there an overview somewhere on the difference between all these different scales, or on how DC uses scale internally? All of this might seem obvious to architects, but lacking an architectural background, I'm finding it a bit difficult to figure out what goes where.
#32350 by Ben at TJB Architects
Mon Jan 28, 2008 7:28 pm
You should be determining the scale based on how big the drawing (plan) is and what size paper you intend to output to?
Draw a border that is 144'x96' (that equals 36"x24" at 1/4" scale) and see if your drawing fits.
Scaling is a real source of confusion for a lot of people, including pretty much every guy that works for us.
It's important that you draw all your objects and plans at REAL WORLD SIZE or you will be in for a world of hurting.
Only text and dimensions should be adjusted for scale output.
#32359 by shovavnik
Tue Jan 29, 2008 6:48 am
Thanks for your help, Ben. I think I wasn't clear, though.

I'm having trouble figuring out the scale for the drawing using DCAL (or rather, D4D).

What I'm trying to accomplish is this:
1. The user clicks on a point in the drawing.
2. The macro places an entity based on a specific symbol at that point.
3. The macro adjusts the new entity's scale to match that of the drawing.

I've got #1 and #2 under my belt and now I'm trying to figure out how to do #3.
#32365 by Jon C. Hubart
Tue Jan 29, 2008 8:37 am
In my case, the scale is selected from a list by the user. "globalscale" is a custom routine that lists a predefined set of scales coded into the macro. I don't search the drawing for scale information. To see how this works you can download the Annotatemacro. I have modified it but the process is the same. You can also get the code for this macro Here
#32376 by shovavnik
Tue Jan 29, 2008 10:28 am
Jon, your macro is very instructional. It helped me figure out that what I'm looking for is called the plot scale.

I'm actually trying to avoid asking the user what the scale is. The purpose is to automatically adjust the size of the symbol.

Say for example, the symbol has a scale of 1:10 and the drawing has a plot scale of 1:50. The aim is for the macro to know that it needs to divide the symbol's scale by 5 when it adds it.

I found the property called symuseplt on the savevar record. It seems this property is modified when clicking on the "Symbol Scale" toggle on the "Ins Symbol" menu when adding a symbol. This looks like what I'm trying to do.

However, when I toggle it in the code (on PGSaveVar) before adding a symbol entity, it doesn't seem to have any effect on the new entity.

Am I on the right track? Is there any way to know what the plot scale is directly?
#32385 by devinder
Tue Jan 29, 2008 12:47 pm
shovavnik wrote:However, when I toggle it in the code (on PGSaveVar) before adding a symbol entity, it doesn't seem to have any effect on the new entity.
Am I on the right track?

You are right track. Options to enlarge symbol entity are specific to particular function, and not part of ent_Add procedure. Thus you enlarge it or not, it is a user preference.

Is there any way to know what the plot scale is directly?

symscale field of PGSaveVar tells you the curent plot scale.
#32388 by Jon C. Hubart
Tue Jan 29, 2008 1:24 pm
shovavnik wrote:I'm actually trying to avoid asking the user what the scale is. The purpose is to automatically adjust the size of the symbol.

Say for example, the symbol has a scale of 1:10 and the drawing has a plot scale of 1:50. The aim is for the macro to know that it needs to divide the symbol's scale by 5 when it adds it.

...

Am I on the right track? Is there any way to know what the plot scale is directly?

One concern with taking the plot scale directly from the file is being sure that the current plot scale is the correct scale for insertion. The user may not have set the plot scale yet, they may have changed it for a quick partial print, or if using Multi-Scale plotting may have several "correct" scales in a single file.

Food for thought.
#32393 by Ben at TJB Architects
Tue Jan 29, 2008 2:30 pm
shovavnik wrote:Thanks for your help, Ben. I think I wasn't clear, though.

I'm having trouble figuring out the scale for the drawing using DCAL (or rather, D4D).

What I'm trying to accomplish is this:
1. The user clicks on a point in the drawing.
2. The macro places an entity based on a specific symbol at that point.
3. The macro adjusts the new entity's scale to match that of the drawing.

I've got #1 and #2 under my belt and now I'm trying to figure out how to do #3.


Oh, wow...yeah, I'm DCAL dumb.
I don't think I possess the synapses required for that...programming makes me hurt inside.
Looks like you got good help, though.
#32395 by shovavnik
Tue Jan 29, 2008 2:52 pm
devinder wrote:symscale field of PGSaveVar tells you the curent plot scale.


Excellent. I'm trying this code:

Code: Select allsv := PGSavevar;
sv.symuseplt := True;
scale := sv.symscale;

ent_init(ent, entsym);
ent.symname := symName;
setscale(ent.Matrix, scale, scale, scale);
cattran(ent.Matrix, pt.x, pt.y, pt.z);
ent_add(ent);


On one drawing, it looks like it's working, but I'm not sure. symscale returns 48. After the setscale method, the matrix shows 48 going down the "identity diagonal" (except for the 4th row/column which equals 1). Is that what I should expect?

But, on two other drawings, symscale returns 0. What does 0 mean?
#32397 by shovavnik
Tue Jan 29, 2008 3:07 pm
Food for thought, indeed.

Jon C. Hubart wrote:One concern with taking the plot scale directly from the file is being sure that the current plot scale is the correct scale for insertion. The user may not have set the plot scale yet, they may have changed it for a quick partial print, or if using Multi-Scale plotting may have several "correct" scales in a single file..


For this project, multi-scale isn't an issue, because the output has to abide to a certain predefined standard that permits only one scale.

I was under the impression, though, that the user could change the view scale anytime, but generally worked on once plot scale.

In any case, how I would I accommodate different plot scales? It looks like I have a problem either way. If I limit the insertion scale to a single scale, and then the user changes the plot scale, the output and the entity scale will always be different. On the other hand, if I take the scale from the plot immediately before insertion, the user is responsible for making sure the plot scale is always the same.
#32398 by shovavnik
Tue Jan 29, 2008 3:11 pm
Ben at TJB Architects wrote:I don't think I possess the synapses required for that...programming makes me hurt inside.


I'm starting to get that feeling about architecture. I had a lot of fun in my architecture class in high school more than a decade ago, but since then, I haven't touched a drafting board, virtual or physical, until I got this project with DataCAD. It's good to know I'm not the only one having trouble picking up some of this stuff :)

Ben at TJB Architects wrote:Looks like you got good help, though.


That's for sure!
#32401 by Jon C. Hubart
Tue Jan 29, 2008 3:30 pm
shovavnik wrote:I was under the impression, though, that the user could change the view scale anytime, but generally worked on once plot scale.

If your not using Multi-scale plotting than you may run into the issue of a detail sheet that contains details of different scales that need to be enlarged. And if enlarging details to work on the printed page you will have to decide if the symbols you mention are inserted at the detail scale or at the page plot scale which may not be the same.
#32404 by Jsosnowski
Tue Jan 29, 2008 5:52 pm
Are you trying to generate a symbol that always prints as the same size on a paper plot?. If so, this is a simlar problem to that confronted in entering text that is always 1/8" high on the paper. To do so implies that the user has an intended plotting scale for the drawing and has set it correctly in the drawing file. If they have not, then they would have to delete your symbol and reinsert it after changing the plot scale or enlarge it (+/-) to the correct size. For similar situations, I have generated a drawing (or symbol of a known dimension, say one foot long, in world length, for a specific element of the symbol such as its overall width. The enlargement applied to it then is always a factor directly related to the plot scale. At quarter inch scale the symbol is 1/4 inch when plotted. If the desired plotted size is 1" then multiply the plot scale by 4 to achieve your goal. IF the plot scale scale were 1/8", multiply by 8. The enlargement is always the inverse of the plot scale.

Am I helping? I don't know if I understand what you are trying to achieve.

Who is online

Users browsing this forum: No registered users and 17 guests

About DataCAD Forum

The DataCAD Forum is a FREE online community we provide to enhance your experience with DataCAD.

We hope you'll visit often to get answers, share ideas, and interact with other DataCAD users around the world.

DataCAD

Software for Architects Since 1984