Personalized scale widget or command

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
sinase
Active Member
Posts: 47
Joined: Sat Jan 30, 2021 11:12 pm

Personalized scale widget or command

Post by sinase » Mon Mar 22, 2021 5:18 pm

Hi,
I need to do a personal widget to scale a figure with previous conditions. Is complicated to me to start this and I will be grateful if you can help me.
I need to do something similar to the original scale function, but I need to calculate previously the factor to be the figure scaled. I will to try to explain that.

I have a figure with wrong millimeters, but i know some real measures. I need to measure one line that I know his real measure and scale this figure with a calculate factor (real measure / draw measure).
ScaleExample.png
ScaleExample.png (24.74 KiB) Viewed 7786 times
I don’t need to see the measure of the drawned figure, I only need this process:
- Select the figure to be scaled.
- Execute personalized scale command or widget.
- Ask me about take measure and take the measure of the draw line.
- Ask me about real measure.
- (Optional) Select the focus point.
- Scale the draw applying the factor (real measure / draw measure).

There is something that help me to do the first step on this.
I hope I explained well.
Many thanks.

CVH
Premier Member
Posts: 3416
Joined: Wed Sep 27, 2017 4:17 pm

Re: Personalized scale widget or command

Post by CVH » Mon Mar 22, 2021 6:08 pm

hi,
Feasible with variables:
https://qcad.org/en/tutorial-input-valu ... easurement

Regards,
CVH

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4935
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: Personalized scale widget or command

Post by Husky » Tue Mar 23, 2021 5:44 am

sinase wrote:
Mon Mar 22, 2021 5:18 pm
I don’t need to see the measure of the drawned figure, I only need this process:
- Select the figure to be scaled.
- Execute personalized scale command or widget.
- Ask me about take measure and take the measure of the draw line.
- Ask me about real measure.
- (Optional) Select the focus point.
- Scale the draw applying the factor (real measure / draw measure).
Just curious! QCAD has already a tool to accomplish that task. What is the reason to invent the wheel again?
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

sinase
Active Member
Posts: 47
Joined: Sat Jan 30, 2021 11:12 pm

Re: Personalized scale widget or command

Post by sinase » Tue Mar 23, 2021 8:47 am

Hi,

I was asking about scale tool but with some particular modifications that facilitate and automate the user's work.

The principal difference, i don't know the measure of the drawed figure when i am executing the scale action. CVH give me an idea to take this measure and save on a variable. It works when i am working with the command line but i can't do this action in scale text box (that last option it would be perfect for me).
ScaleExample1.png
ScaleExample1.png (22.74 KiB) Viewed 7726 times
I can do this:
- Take a measure with command line.
ScaleExample2.png
ScaleExample2.png (24.87 KiB) Viewed 7726 times
- I have the measure on "d1" variable.
ScaleExample3.png
ScaleExample3.png (2.09 KiB) Viewed 7726 times
- Scale action.
ScaleExample4.png
ScaleExample4.png (20.46 KiB) Viewed 7726 times

Sorry if i asking something repetitive, but is it possible to execute all the scale action only with command line? For example, in this case, something like this "scale 100/d1".

Many thanks.
Regards.

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: Personalized scale widget or command

Post by andrew » Wed Mar 24, 2021 11:52 am

sinase wrote:
Tue Mar 23, 2021 8:47 am
Sorry if i asking something repetitive, but is it possible to execute all the scale action only with command line? For example, in this case, something like this "scale 100/d1".
No, that is not the intention. You'd have to use a script to achieve that.

sinase
Active Member
Posts: 47
Joined: Sat Jan 30, 2021 11:12 pm

Re: Personalized scale widget or command

Post by sinase » Wed Mar 24, 2021 5:56 pm

Thank you for the answer, could you help me with a simple example of that please?

I would need,

(1) ask me to take a measure and save on a variable (d1)
(2)ask me to write the real measure and save on other variable (d2)
(3) ask me to select the elements that i need to scale with a factor d2/d1
(4) scale and delete the original elements.

I know that the QCAD scale function do this but i need to automatizate the proccess the maximum possible to aviod user's mistakes.

Is there a similar example that it help me?

Many thanks!
Regards.

CVH
Premier Member
Posts: 3416
Joined: Wed Sep 27, 2017 4:17 pm

Re: Personalized scale widget or command

Post by CVH » Thu Mar 25, 2021 10:34 am

Hi,

Yes, about any method that requires a selection, a picked entity and a picked point is an example.

In the line of common QCAD methods:
- Make selection. (Method requires selection)
- Activate tool.
- Select focal point.
- Select reference entity to get its length.
- Display dialog for real measurement.

When complied to dialog:
>> Uniform scale selected by factor in regards with the focal point.
>> Update entities.

State 1 = SettingPos (PickCoordinate)
State 2 = ChoosingEntity (PickEntity)
State 3 = dialog

What comes close qua states:
- LineOrthogonal.js, a specific case of LineRelativeAngle.js
- Offset.js
...

Regards,
CVH

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”